Lookup function on cast map returns string cast null value

Hello,

I encountered an issue while using the terraform aws elastic load-balancer module and I cannot figure out where the issue comes from and how to fix it.

I reported a bug on the terraform github, thinking it was a terraform issue, but I was told it’s not a bug.

here is the github issue: lookup function on cast map returns string cast null value · Issue #29171 · hashicorp/terraform · GitHub

I now understand that null value in terraform can be typed, but I don’t understand how to cast a value that doesn’t exist.

Right now, because of this issue, we cannot use conditions and we had to duplicate all our variables to fit both side of the condition (which is far from ideal).

If anyone has an idea how to go around this, that’d be amazing.
Thank you