【发布时间】:2021-08-17 05:12:40
【问题描述】:
尝试有条件地运行模块。
期望:仅当 env 不等于 prd 时才运行模块
module "database_diagnostic_eventhub_setting" {
count = var.env != "prd" ? 1 : 0 // run block if condition is satisfied
source = "git::https://git_url//modules/...."
target_ids = [
"${data.terraform_remote_state.database.outputs.server_id}"
]
environment = "${var.environment}-database-eventhub"
destination = data.azurerm_eventhub_namespace_authorization_rule.event_hub.id
eventhub_name = var.eventhub_name
logs = [
"PostgreSQLLogs",
"QueryStoreWaitStatistics"
]
}
错误:
The name "count" is reserved for use in a future version of Terraform.
【问题讨论】:
-
你安装的是哪个版本的TF?在 0.13 中添加了通过
count创建条件模块的支持,请参见 terraform.io/docs/language/meta-arguments/count.html 的顶部 -
@kost 这很可能是一个答案
标签: terraform terraform-provider-azure