I have a formatting issue that I cannot figure out. The soa_record seems to fail on the email. Maybe the soa_record block is not being defined correctly?
Code and error below.
variable "private_dns_zones" {
description = "A list of Private DNS Zones and their properties."
type = list(object({
name = string
resource_group_name = string
tags = map(string)
soa_record = object({
email = string
expire_time = number
minimum_ttl = number
refresh_time = number
retry_time = number
ttl = number
})
}))
}
resource "azurerm_private_dns_zone" "this" {
for_each = { for n in var.private_dns_zones : "${n.name}" => n } #name of private dns zone is unique
name = each.value.name
resource_group_name = each.value.resource_group_name
tags = merge(data.azurerm_resource_group.this[each.value.resource_group_name].tags, each.value.tags)
soa_record = {
email = each.value.soa_record.email
expire_time = each.value.soa_record.expire_time
minimum_ttl = each.value.soa_record.minimum_ttl
refresh_time = each.value.soa_record.refresh_time
retry_time = each.value.soa_record.retry_time
ttl = each.value.soa_record.ttl
}
}
ERROR
╷
│ Error: "soa_record.0.email" only contains letters, numbers, underscores, dashes and periods
│
│ with module.private_dns_zones.azurerm_private_dns_zone.this["zone1.local"],
│ on Modules/privatednszone/main.tf line 22, in resource "azurerm_private_dns_zone" "this":
│ 22: email = each.value.soa_record.email
│
╵
╷
│ Error: "soa_record.0.email" only contains letters, numbers, underscores, dashes and periods
│
│ with module.private_dns_zones.azurerm_private_dns_zone.this["zone2.local"],
│ on Modules/privatednszone/main.tf line 22, in resource "azurerm_private_dns_zone" "this":
│ 22: email = each.value.soa_record.email
CodePudding user response:
If you check Azure docs you will find that they use email
format without @
. For example:
--email myhostmaster.mysite.com
Thus I guess, that you have to follow same format in TF.