News for hackers. Stuff that matters.
Re:Terraform should have remained stateless by boesboes on Saturday May 28, 2022 @05:42AM (#31538962)
Personally I think the custom dsl’s are a bigger issue. I spend a lot of time wrangling tf to have reusable, configurable modules.

The more i use tf, the more i think it would be better to remove _all_ dynamic features and use a real language to generate tf configs as flat, static files.

Re:Terraform should have remained stateless by pst on Saturday May 28, 2022 @09:27AM (#31540172)
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.

Re:Terraform should have remained stateless by boesboes on Saturday May 28, 2022 @10:13AM (#31540487)
Yeah there is definitly something to be said for having a limited DSL. I feel though the language as-is, has a bit to much dynamic features that kinda half work and then give you completly useless error messages. But tbf, it has gotten alot beter with recent versions.

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.

Re:Terraform should have remained stateless by erik_seaberg on Saturday May 28, 2022 @06:54PM (#31544584)
I want both config and code to be concise and clear. “Boring” means it’s unfinished and contains small mistakes that we miss when our eyes glaze over.
Re:Terraform should have remained stateless by hackandtrip on Saturday May 28, 2022 @05:51AM (#31539003)
Did you give a try to https://www.terraform.io/cdktf ?

Unfortunately, it is not stable yet... but we all used Terraform <1.0 for years, and I'd say the experience was never that bad.