Simple tool to convert JSON files to HCL2 files and vice versa. It was intended for personal use and therefore its implementation might have a few flaws (I'm not a Go expert, but I have been using it for a while and I really like it).
Download the binary fitting your platform from the releases page.
hclconv --in sample.tfvars --out sample.tfvars.json
hclconv --in sample.tfvars.json --out sample.tfvars
NOTE: This requires the terraform
CLI tool to be installed as the format is done by running terraform fmt <output-file>
.
hclconv --format --in sample.tfvars.json --out sample.tfvars
Contributions are very welcome ! As written initially, there might be a few things that can be improved. So if you stumble across this project and want to add things or improve the implementation, feel free to propose your changes :)
Rene Schach - @relusc