Terraform is not a programming language
And this is exactly why in some cases you end up coming up with maybe weird and unnecessarily complex code to achieve something that you can easily fix if you had the conveniences of a programming language (like if else statements, for loops, etc.). There have been plenty of cases where you would want to generate something in your cloud init on the fly or just add something to some other configuration file, but you couldn’t extract the exact data you need because you want to loop over something or only add stuff that meets a certain condition.
Template Syntax in Terraform 0.12
Among a lot of other absolutely great features, which I’ll talk about in other blogposts, we finally get to play with if else statements and for loops. HashiCorp have a blogpost about it and some of the things you’d be able to do in the latest release. I’m super excited to get my hands on this and play with it when it releases. I’m sure a lot of you would find it absolutely amazing as well.
Have fun Terraforming. 😃