简体   繁体   English

Terraform 计数功能使用 IF / OR

[英]Terraform Count Functionality Using IF / OR

I'd like to set the count function for a terraform resource to be dependent on the value of a variable.我想将 terraform 资源的计数 function 设置为依赖于变量的值。

In plain English I would like the following...用简单的英语,我想要以下...

IF var.domain_name_suffix is equal to "all" OR "GW", Set Count to 1.如果 var.domain_name_suffix 等于“all”或“GW”,则将 Count 设置为 1。

ELSE Set count to 0. ELSE 将计数设置为 0。

I suggest reading the documentation .我建议阅读文档

count = var.domain_name_suffix == "all" || var.domain_name_suffix == "GW" ? 1 : 0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM