Here is my terraform configuratiom
resource "azurerm_cdn_frontdoor_route" "route" {
name = "${var.target_name}-cdn-route"
cdn_frontdoor_endpoint_id = azurerm_cdn_frontdoor_endpoint.endpoint[0].id
cdn_frontdoor_origin_group_id = azurerm_cdn_frontdoor_origin_group.origin_group[0].id
cdn_frontdoor_origin_ids = [azurerm_cdn_frontdoor_origin.origin[0].id]
enabled = true
forwarding_protocol = "MatchRequest"
https_redirect_enabled = true
patterns_to_match = ["/*"]
supported_protocols = ["Http", "Https"]
cdn_frontdoor_custom_domain_ids = [azurerm_cdn_frontdoor_custom_domain.custom_domain[0].id]
link_to_default_domain = false
}
}
resource "azurerm_cdn_frontdoor_route" "route_additionaldomains" {
for_each = var.afd_enabled == "1" ? toset(local.additionalDomains) : toset([])
name = "${replace(each.key, ".", "-")}-cdn-route"
cdn_frontdoor_endpoint_id = azurerm_cdn_frontdoor_endpoint.endpoint[0].id
cdn_frontdoor_origin_group_id = azurerm_cdn_frontdoor_origin_group.origin_group[0].id
cdn_frontdoor_origin_ids = [azurerm_cdn_frontdoor_origin.origin[0].id]
enabled = true
forwarding_protocol = "MatchRequest"
https_redirect_enabled = true
patterns_to_match = ["/*"]
supported_protocols = ["Http", "Https"]
cdn_frontdoor_custom_domain_ids = [azurerm_cdn_frontdoor_custom_domain.custom_domain_additionaldomains[each.key].id]
link_to_default_domain = false
dynamic "cache" {
for_each = local.cache
content {
query_string_caching_behavior = cache.value.query_string_caching_behavior
query_strings = cache.value.query_strings
compression_enabled = cache.value.compression_enabled
content_types_to_compress = cache.content_types_to_compress
}
}
}
resource "azurerm_cdn_frontdoor_custom_domain_association" "custom_domain_association" {
count = var.afd_enabled
cdn_frontdoor_custom_domain_id = azurerm_cdn_frontdoor_custom_domain.custom_domain[0].id
cdn_frontdoor_route_ids = [azurerm_cdn_frontdoor_route.route[0].id]
resource "azurerm_cdn_frontdoor_custom_domain_association" "custom_domain_association_additionalDomains" {
for_each = var.afd_enabled == "1" ? toset(local.additionalDomains) : toset([])
cdn_frontdoor_custom_domain_id = azurerm_cdn_frontdoor_custom_domain.custom_domain_additionaldomains[each.key].id
cdn_frontdoor_route_ids = [azurerm_cdn_frontdoor_route.route_additionaldomains[each.key].id]
}
}
Error: deleting Front Door Custom Domain Association: (Association Name "wildcard-mcvr-span2-example-app" / Profile Name "mcvr-span-cdn" / Resource Group "mcvr-span-rg"): Front Door Custom Domain: (Custom Domain Name "wildcard-mcvr-span2-example-app" / Profile Name "mcvr-span-cdn" / Resource Group "mcvr-span-rg"): updating the association with Front Door Route: (Route Name "mcvr-span2-example-app-cdn-route" / Afd Endpoint Name "mcvr-span-cdn-ep" / Profile Name "mcvr-span-cdn" / Resource Group "mcvr-span-rg"): cdn.RoutesClient#Update: Failure sending request: StatusCode=400 -- Original Error: Code="BadRequest" Message="The route domains, paths and protocols configuration has a conflict. More information: Domain: mcvr-span-cdn-ep, Path pattern: /*, Protocol: Https cannot be added to Route mcvr-span2-example-app-cdn-route as this combination already exists in Endpoint mcvr-span-cdn-ep, Route mcvr-span-cdn-route.."
```
I am trying create multi custom domains. so creating is working fine but while destroy Front Door Custom Domain Association its trying to update route and point to default domain which default route configuration are same. its lead to the above issue.
Any suggestion ?