Skip to main content

One post tagged with "workarounds"

View All Tags

Bypassing Terraform error: “The true and false result expressions must have consistent types”

· 2 min read
Manu Magalhães
DevSecOps Engineer

Have you ever came across this Terraform error — when you intentionally want your ternary to output different types?

The true and false result expressions must have consistent types

To bypass this Terraform limitation, check the tip below. I'll follow it with two examples to clarify the usage:

attribute = [
<desired output if true>,
<desired output if false>
][<condition> ? 0 : 1]