0

Trying to get TF to map custom domains to my deployment slot and not working.

resource "azurerm_app_service_slot_custom_hostname_binding" "xxx_staging" {
  count               = terraform.workspace == "prod" ? 1 : 0
  app_service_slot_id = azurerm_linux_web_app_slot.staging[0].id
  hostname            = "prod.${local.xxx_apex_domain}"
  depends_on          = [azurerm_dns_txt_record.appservice_xxx_domain_verification_id]

  lifecycle {
    ignore_changes = [ssl_state, thumbprint]
  }
}

Throwing the following error:

Error: creating App Service Slot Custom Hostname Binding: (Host Name Binding Name "prod.xxx.xxx.xxx.xx" / Slot Name "staging" / Site Name "xxxxx" / Resource Group "xxxx"): web.AppsClient#CreateOrUpdateHostNameBindingSlot: Failure sending request: StatusCode=409 -- Original Error: autorest/azure: Service returned an error. Status=nil nil

Stego
  • 87
  • 1
  • 11

1 Answers1

0

The hostname = "prod.${local.xxx_apex_domain}" is already configured in the another app service or slot. just delete the custom domain from another app service or slot.