使用嵌套 for_each 时 terraform 抛出错误

时间:2021-06-18 14:49:30

标签: terraform wavefront

我有一个如下所示的 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
                }
            }
        }
        }
    }

0 个答案:

没有答案