devenv/tf/publicdns.tf (18 lines of code) (raw):
variable "publiczones" {
type = set(string)
default = [
"ingress-war-public-1.dev",
"ingress-war-public-2.dev"
]
}
resource "azurerm_dns_zone" "dnszone" {
for_each = var.publiczones
name = "${random_string.random.result}-${each.value}"
resource_group_name = azurerm_resource_group.rg-public.name
}
resource "azurerm_role_assignment" "approutingdnszone" {
for_each = azurerm_dns_zone.dnszone
scope = each.value.id
role_definition_name = "Contributor"
principal_id = data.azurerm_user_assigned_identity.clusteridentity.principal_id
}