Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Sun committed Oct 25, 2024
1 parent 238fd09 commit a445a31
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
10 changes: 5 additions & 5 deletions ESLZ/front-door.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ front_doors ={
profile_name = "example-frontdoor-profile"
profile_sku = "Premium_AzureFrontDoor" # Options: Standard_AzureFrontDoor, Premium_AzureFrontDoor


dns={
internal_dns_zone_name ="zone1"
internal_dns_record_name = "www"
ttl=3600
}
# Front Door Origin Groups
origin_group = {

Expand Down Expand Up @@ -56,16 +60,12 @@ front_doors ={
custom_domains = {
custom-domain1 = {
host_name = "custom.example.com"
internal_dns_record = false
internal_dns_zone_name = null
certificate_type = "ManagedCertificate"
minimum_tls_version = "TLS12"
ttl =3600
}
custom-domain2 = {
host_name = "www.custom.example.com"
internal_dns_record = true
internal_dns_zone_name = "zone1"
certificate_type = "ManagedCertificate"
minimum_tls_version = "TLS12"
ttl=3600
Expand Down
33 changes: 13 additions & 20 deletions module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,33 +117,26 @@ resource "azurerm_cdn_frontdoor_custom_domain_association" "domain_association"
}

resource "azurerm_dns_cname_record" "cname_record" {
for_each = {
for key, value in var.front_door.custom_domains : key => value
if value.internal_dns_record == true
}
depends_on = [azurerm_cdn_frontdoor_route.route, azurerm_cdn_frontdoor_security_policy.fd_security_policy]

name = each.value.host_name
zone_name = var.zones[each.value.internal_dns_zone_name].name
name = try(var.front_door.dns.internal_dns_record_name, "www")
zone_name = var.zones[try(var.front_door.dns.internal_dns_zone_name, "zone1")].name
resource_group_name = var.resource_groups["DNS"].name
ttl = try(each.value.ttl,3600)
ttl = try(var.front_door.dns.ttl,3600)
record = azurerm_cdn_frontdoor_endpoint.endpoint.host_name
}

resource "azurerm_dns_txt_record" "txt_record" {
for_each = {
for key, value in var.front_door.custom_domains : key => value
if value.internal_dns_record == true
}
name = join(".", ["_dnsauth", "${each.value.host_name}"])
zone_name = var.zones[each.value.internal_dns_zone_name].name
resource_group_name = var.resource_groups["DNS"].name
ttl = try(each.value.ttl,3600)
# resource "azurerm_dns_txt_record" "txt_record" {

record {
value = azurerm_cdn_frontdoor_custom_domain.custom_domain[each.key].validation_token
}
}
# name = join(".", ["_dnsauth", "${var.front_door.dns_record_name}"])
# zone_name = var.zones[var.front_door.azure_dns_zone_name].name
# resource_group_name = var.resource_groups["DNS"].name
# ttl = try(each.value.ttl,3600)

# record {
# value = azurerm_cdn_frontdoor_profile.frontdoor_profile.do
# }
# }


# Azure Front Door Rule Sets
Expand Down

0 comments on commit a445a31

Please sign in to comment.