|
|
|
|
|
by pst
1491 days ago
|
|
Yes, conditionals and loops in TF are limited and have various annoying and surprising edge cases. But if something is hard to do with the Terraform DSL it's usually a good idea to reconsider if it is really something that one should be doing. We want infrastructure automation to be boring and just work. The risk with general purpose programming languages is that people will always find a way to outsmart themselves. Yes, sure, you can use the testing tool chain of the language of your choosing. But it's not like we have figured out to write software without bugs, despite all the awesomeness of modern languages. |
|
But to explain where I'm coming fromm, this is something I ran into recently:
this breaks and returns null if http is not set: lookup(each.value.http, "port", 8080)
So I need to do this to make it work: coalesce(lookup(each.value.http, "port"), 8080)
Not a huge deal, but just one of these many things over the years where I think don't reinvent the wheel.