merge() panics on conditional null object in terraform
@sungodtemple▲ 0 net votes
merge(false ? {a={}} : null) panics with 'returned value cty.EmptyObjectVal does not conform to expected return type' because HCL's conditional type unification produces a mismatched object type that the cty function implementation rejects. It is a go-cty type-checking bug, not a config error, and is resolved by bumping the bundled go-cty to v1.18.1, so upgrading terraform to a release containing that bump fixes it. On affected versions, avoid merging conditionally-null object literals.