I was hoping that smart guys vs bad situation will have another outcome but Terraform language for version 0.12 looks bad… as languages of Puppet and Ansible.
I’m not saying that people that made Puppet and Ansible are not smart. It’s that we could learn from the mistakes they made… unless we don’t consider those being mistakes.
Puppet and Ansible went through very similar difficult situation. They have limited themselves to a declarative format and then they tried to accommodate the real life. Terraform has this situation right now.
The situation is:
- Declarative format being used
- People need something more powerful, like a programming language because … real life where conditionals, loops and data transformations make much more sense than working around declarative languages limitations.
Interestingly enough, they all did not switch to a proper programming language. Maybe because that would be at least partially admitting that the product should have been a library in the first place?
Terraform is actually in very crappy situation because even if they decide to expose everything as a library as the main interface, I don’t see people start using Go for “infrastructure as code”. Not as smooth as Ruby or Python anyway.
Happy coding, everyone!
On a bit more positive note, the new splat operator looks like an improvement.
Terraform looks even more like a “normal” language with Conditional Operator Improvements and
null value. The conditional operator fixes previous oddities that it had.
Terraform got type system. Looks powerful. Just need to see that Terraform does not evolve to Scala 🙂
New template syntax brings more raw power. Looks good.
- HCL to JSON one-to-one mapping. When I read “having a clean 1:1 mapping between HCL and JSON, and ensuring every feature of HCL is supported in JSON” I immediately thought that there must be converting tools then… and was not disappointed 🙂 “In future versions of Terraform, we will also support native tooling to convert HCL to JSON and JSON to HCL cleanly (including comments)”
- “Comments in JSON” – nice!
6 thoughts on “Terraform 0.12 language looks bad”
You might consider taking another look at ansible documentation. I think you will find that modern versions of ansible playbooks are effectively a python library.
I do agree that earlier versions of ansible, especially in the ~1.4ish era, were quite limited.
Recently though playbook language is quite expressive and robust.
I’d be happy to provide some examples for any particular issues you had with the language previously, but the items in your post (conditions, loops, transformations) are all very well supported and should not be too difficult to discover.
The ansible mailing list is also generally rather helpful.
I think you’re absolutely right about terraform 0.12 though. The language is very bad.
What are you even talking about? Are you talking about HCL? Are you saying that HCL looks bad?
The link is specifically to new features of version 0.12 and the title says 0.12. I assumed it’s specific enough. On the other hand, yes I didn’t give specifics.
I’m talking about “for” list and map comprehensions (did not like it in Python either); syntax for grouping (ellipsis); “dynamic” that has for_each inside; placing “for_each” inside a resource as opposed to outside.
It is HCL at the end of the story.
Is the TL;DR of this “I don’t like DSLs”?
I’d phrase it “I don’t like ‘simple’ DSLs which supposed to be just declarative syntax and are becoming a programming languages as an afterthought”. I also think it’s extremely challenging to make a good DSL.