Terraform or condition in template

Hi All,
is it possible to have a OR condition in if statements into templatefile?

Thanks in advance,

Hi @cello86,

The Terraform language uses operators similar to the C family of programming languages (C, JavaScript, etc) and so in Terraform the logical OR operator is named ||.

The predicate expression in an if directive in a template can be any Terraform language expression that returns a boolean value, and so it’s fine to use the logical OR operator there to combine two other tests:

%{ if something || something_else }
${ endif }

This || operator is not specific to the template language; it’s valid to use in any situation where Terraform is expecting an expression that produces a boolean value.

You can read more about the logical operators in the documentation: Logical Operators.