gpt4 book ai didi

amazon-web-services - 有条件地启用或禁用 root main.tf terraform 中的模块

转载 作者:行者123 更新时间:2023-12-05 00:53:03 25 4
gpt4 key购买 nike

我们如何选择或禁用根 main.tf 中的模块

示例:

module "foo" {
source = "bar"
count = "${var.include_module ? 1 : 0}"

}

根据 terraform 问题讨论,上述方法不起作用 link

还有其他方法吗?

最佳答案

您使用的 Terraform 版本是什么? Terraform 版本 0.13.0 中引入了模块的 countfor_each .

请注意,您使用的插值语法已被弃用。使用:

count = var.include_module ? 1 : 0

关于amazon-web-services - 有条件地启用或禁用 root main.tf terraform 中的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68592817/

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