Hacker News new | ask | show | jobs
by hamandcheese 974 days ago
HCL makes this an instant pass for me.

Don't get me wrong - I love the idea of a declarative language for config. But HCL is just not pleasant.

Actually decent languages for that would be nix, jsonnet, or starlark.

2 comments

I have to agree. I'm writing Terraform files most of the day, and I don't stop to wonder why we still have to deal with it, and why every editor should support it in 2023 when we have much better alternatives such as Jsonnet, Skylark/Starlark, Cue, Dhall, etc. It's the "Not Invented Here" syndrome in the context of HashiCorp.

The only benefit of HCL is HCL v2, which allows you to write expressions without quotes, but this is supported by all alternatives listed above.

HCL has a JSON representation [1], internally, objects behave that way. so it should be possible to write a Jsonnet wrapper around it. Terraform can currently parse json pipelines too.

[1]: https://github.com/hashicorp/hcl/blob/main/json/spec.md

No, it's not the same - you need a preprocessor. I do use JSON with Terraform via CDKTF although git diff is way more unreadable than with HCL. So, JSON is definitely a bad idea, but HCL v2 is not as good as the alternatives.
Also look at nickel which is an evolution of nix. It's my favorite in this space.

nickel-lang.org

https://github.com/tweag/nickel