From 346d6014abe7820b9abcae56f07c9a05f55ada92 Mon Sep 17 00:00:00 2001 From: Colin Saliceti Date: Mon, 18 Dec 2023 17:00:36 +0000 Subject: [PATCH] WIP --- dns/zones/resources.tf | 46 +++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/dns/zones/resources.tf b/dns/zones/resources.tf index ce136ab..159dc68 100644 --- a/dns/zones/resources.tf +++ b/dns/zones/resources.tf @@ -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 } }