Convert .tfvars to .tfvars.json and vice versa

Hi Team,
I want to convert the .tfvars file to .tfvars.json and vice versa.
Is there any library available with Hashicorp to achieve this or any support for implementing this conversion using python or golang?


Not a complete converter but a helper.

You could also look into
python-hcl2 - GitHub - amplify-education/python-hcl2

Thank you for your help.
I will try this solution and will revert back to you if any further assistance needed.

Priya Shinde

Meanwhile I found this online tools and it works very well for me:


or if you want to get local tool:
gorpher/hcl2json: Convert HCL to JSON , and vice versa. Use newst hcl verison to build. (