Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
saliceti committed Dec 18, 2023
1 parent c3e0bc5 commit 346d601
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions dns/zones/resources.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,42 @@ resource "azurerm_dns_zone" "dns_zone" {
# CAA record

locals {
caa_records = flatten([
for zone_name, zone_cfg in var.hosted_zone : [
for record_name, record_cfg in zone_cfg["caa_records"] : {
record_name = record_name
zone_name = zone_name
resource_group_name = zone_cfg["resource_group_name"]
flags = record_cfg["flags"]
tag = record_cfg["tag"]
value = record_cfg["value"]
}
]
])
# caa_records = flatten([
# for zone_name, zone_cfg in var.hosted_zone : [
# for record_cfg in zone_cfg["caa_records"] : {
# zone_name = zone_name
# resource_group_name = zone_cfg["resource_group_name"]
# value = record_cfg["value"]
# }
# ]
# ])
}

resource "azurerm_dns_caa_record" "caa_records" {
for_each = {
for zone in local.caa_records : "${zone.zone_name}.${zone.record_name}" => zone
}
# Iterate over each zone and each CAA domain
# for_each = {
# for zone in local.caa_records : "${zone.zone_name}.${zone.record_name}" => zone
# }

for_each = var.hosted_zone

name = "@"
zone_name = each.value.zone_name
zone_name = each.key
resource_group_name = each.value.resource_group_name
ttl = 300

record {
flags = each.value.flags
tag = each.value.tag
value = each.value.value
}
# record {
# flags = each.value.flags
# tag = each.value.tag
# value = each.value.value
# }

dynamic "record" {
for_each = var.settings
for_each = each.value.caa_records
content {
flags = 0
tag = "issue"
value = record.value.value
value = record.key
}
}

Expand Down

0 comments on commit 346d601

Please sign in to comment.