我有一个如下所示的 Terraform 文件。使用 for_each 处理嵌套地图。我收到类似
的错误此处不需要“top_block”类型的块。 参数“name”是必需的,但未找到定义。
代码有问题吗?
locals{
servers = {
typea = {
1a = {
}
1b = {
}
}
typeb = {
1a = {
}
1b = {
}
}
}
}
resource "wavefront_alert" "new_alert" {
dynamic "top_block" {
for_each = local.servers
content {
storage = each.key
dynamic "inner_block" {
for_each = top_block.value
content {
location = inner_block.key
location_alert = inner_block.value
alert_type = "THRESHOLD"
name = "${storage}-${location}"
conditions = {
}
threshold_targets = local.threshold_targets
display_expression = "expression"
minutes = 5
}
}
}
}
}