diff --git a/k8s-external-dns-azure/iam.tf b/k8s-external-dns-azure/iam.tf index 47e3a270..31fef9df 100644 --- a/k8s-external-dns-azure/iam.tf +++ b/k8s-external-dns-azure/iam.tf @@ -29,8 +29,10 @@ resource "azurerm_role_assignment" "external_dns" { } resource "kubernetes_secret" "external_dns" { + for_each = { for zone in var.azure_dns_zones.dns_zones : zone => zone } + metadata { - name = "external-dns-auth" + name = "external-dns-auth-${each.value}" namespace = var.namespace labels = var.md_metadata.default_tags } diff --git a/k8s-external-dns-azure/main.tf b/k8s-external-dns-azure/main.tf index 031e0c1e..51e2cc8c 100644 --- a/k8s-external-dns-azure/main.tf +++ b/k8s-external-dns-azure/main.tf @@ -1,15 +1,16 @@ module "external-dns" { + for_each = { for zone in var.azure_dns_zones.dns_zones : zone => zone } source = "../k8s-external-dns" md_metadata = var.md_metadata kubernetes_cluster = var.kubernetes_cluster - release = var.release + release = regex("^[a-z0-9-]+", "${var.release}-${each.value}") namespace = var.namespace domain_filters = local.domain_filters helm_additional_values = { extraVolumes = [{ name = "azure-config-file" secret = { - secretName = kubernetes_secret.external_dns.metadata[0].name + secretName = kubernetes_secret.external_dns[each.key].metadata[0].name items = [{ key = "azure.json" path = "azure.json"