Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why do I care what some random guy’s HCL to JSON conversion tool thinks is valid?

Terraform converts HCL to JSON in a different way that makes a lot more sense, and hcldec provided by Hashicorp lets you define your own specification for how you want to use it.

I would like to point out that perfect compatibility with JSON is not a goal nor a requirement of a decent configuration language.



Hashicorp ships official packages that wrap hcl2json:

https://www.npmjs.com/package/@cdktf/hcl2json

https://github.com/hashicorp/terraform-cdk/tree/main/package...

I use the package to implement module dependency graph tracking across our terraform monorepo for things like code reviews and CI triggering.


I can't speak to the quality of CDK, which is 10x less popular by GitHub stars than base Terraform and is marked as experimental/bleeding edge and pre-1.0 by Hashicorp's own documentation. If they're using a hacky workaround of some guy's software that definitely sounds like something that pre-1.0 software would do.

I've found HCL perfectly adequate for vanilla Terraform, furthermore I've found no real reason to leverage CDK.

To be clear I am not saying HCL is amazing, merely that it's adequate and better than YAML, and that I'm not sure how it could be considered confusing. I personally think HashiCorp has jumped the shark since the IBM acquisition and that CDK will never gain mass adoption in a significant way.


You seem to have skipped over your initial citation of it being invalid syntax, to say nothing of the sibling comment to yours also using that opaque syntax

As for why I linked to "some random guy," that's because the Hashicorp people in their infinite wisdom didn't ship any rendering binary so some kind soul had to glue one to the official sdk https://github.com/tmccombs/hcl2json/blob/v0.6.7/go.mod#L8

I hear you about JSON might not be a goal, but I can tell you that Terraform accepts .json files just as much as it accepts .hcl files so that sane people can generate them, because sane people cannot generate HCL https://developer.hashicorp.com/terraform/language/syntax/js...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: