V0.12 native support for HCL to JSON conversion

Hi,

The article says that there is native support coming for hcl to json conversion in v0.12. Do we have any update post Aug 2018

Hi @Rajeevm2019,

That article is incorrect (or rather, outdated). There are no current plans to produce a tool for converting between HCL and JSON.

Such a conversion should not be necessary, because Terraform already directly supports both formats and allows you to mix them in a single configuration so that you can have human-authored files in native syntax alongside machine-generated files in JSON syntax.

To distinguish between native syntax and JSON syntax, use the .tf suffix for native syntax files and .tf.json for JSON syntax files.

Just noting that while a conversion tool might not be necessary for providing configuration to Terraform, it would be super helpful for parsing HCL with other tools. If there was a native way to convert HCL to JSON, other tools could read the configuration easily without having to implement their own HCL parser.

3 Likes

Agreed, it would save devs an enormous amount of time to have a parser for other languages that could reliably parse HCL directly or via json