Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion infrastructure/modules/cdn-frontdoor-endpoint/dns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ resource "azurerm_dns_cname_record" "custom" {
resource "azurerm_dns_txt_record" "challenge" {
for_each = { for k, v in var.custom_domains : k => v if v.tls.certificate_type == "ManagedCertificate" }

name = join(".", compact(["_dnsauth", replace(each.value.host_name, ".${each.value.dns_zone_name}", "")]))
# If the host name is the same as the zone name, then it's the apex domain
# Apex domain requires _dnsauth. Subdomains require _dnsauth.<subdomain>.
name = each.value.host_name == each.value.dns_zone_name ? "_dnsauth" : "_dnsauth.${each.value.host_name}"
zone_name = each.value.dns_zone_name
resource_group_name = each.value.dns_zone_rg_name
ttl = 60
Expand Down
Loading