简体   繁体   中英

Use multiple conditions for count in terraform ternary operations using elseif

I am trying to get terraform to create a resouce based on the count conditon as below, i cant get my head around the syntax, it should be something like below:

count = “${var.size[terraform.workspace] == "big" ? && local.ips[terraform.workspace] != “<none>“} then 10
elseif
${var.size[terraform.workspace] == "small"  && local.ips[terraform.workspace] != “<none>” } then 20
else 0 

在下面测试

count = "${lookup(var.size, terraform.workspace, "None") == "big" && lookup(local.ips, terraform.workspace, "None") != "None" ? 10 : lookup(var.size, terraform.workspace, "None") == "small" && lookup(local.ips, terraform.workspace, "None") != "None" ? 20 : 0}"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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