gpt4 book ai didi

azure - Terraform block 资源语法失败

转载 作者:行者123 更新时间:2023-12-03 02:18:44 25 4
gpt4 key购买 nike

我遇到了无法解决的格式问题。 soa_record 似乎在电子邮件上失败。也许 soa_record block 没有正确定义?

下面的代码和错误。

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: "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

最佳答案

如果您检查Azure docs你会发现他们使用email格式,没有@。例如:

--email myhostmaster.mysite.com

因此我猜想,您必须在 TF 中遵循相同的格式。

关于azure - Terraform block 资源语法失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69997509/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com