替代条件陈述“计数”在Terraform
我有一个只想在生产环境中构建的AWS资源。通常,我会使用类似的东西:
count = var.environment == "production" ? 1 : 0
但是,根据Terraform文档,在模块中用于Terraform低于13的版本中时不支持计数。语言/meta-arguments/count“ rel =“ nofollow noreferrer”>在Terraform 0.13中添加了对计数的模块支持,并且以前的版本只能将其用于资源。”)
我正在使用Terraform 12,并且资源为12来自模块,所以我想要一个只有在生产中构建资源的条件语句
I have a aws resource that i only want to be built in the production environment. Usually i would use something like this:
count = var.environment == "production" ? 1 : 0
However, as per the terraform documentation, count is not supported when used in a module for versions of terraform lower than 13. ("Module support for count was added in Terraform 0.13, and previous versions can only use it with resources.")
I am using terraform 12 and the resource is coming from a module and so I would like a different conditional statement that will only build the resource in production but not sure what else there is other than the count function
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我评论的更多详细信息:
这是我的测试模块“策略”,代码类似于:
调用模块
Here is more details on my comments:
Here is my test module "policies", code is something like:
calling the module