jeudi 7 octobre 2021

How to "simulate" or emulate if-then-else or case-statement in Terraform

I am looking for a way to do this in Terraform, if possible. Assume that ami and region are variables in the variable.tf file. (in pseudo-code)

If region = "us-east-1" then
  ami = "123455679"
else if region = "us-west-1" then
  ami = "98765432"
endif

I know there is no "if-then-else" or case-statements in Terraform but seems like there should be a way to do this.

Is it possible? Can you point me to an example or article?

TIA Bill W

Aucun commentaire:

Enregistrer un commentaire