Skip to content

terraform Cheat Sheet

Expressions

Conditional Expressions

locals {
  multi   = true
  tenancy = local.multi ? "foo,bar" : "foo"
}

output "tenancy" {
  value = local.tenancy
}

equal to:

# check if multi is True
if multi:
  tenancy = "foo,bar"
# assume that multi is False
else:
  tenancy = "foo"

Comments