.tf.json to .tf convertor

I am writing a small converter for NetScaler configuration to equivalent terraform resources.
My design includes an intermediatory step of having .tf.json

ns.conf -> main.tf.json -> main.tf

I have achieved till main.tf.json.

I am looking for a tool to convert my main.tf.json to main.tf before I write on my own.

Please help.

Hi @sumanth-lingappa,

There is no tool to convert from the JSON syntax to the native syntax, because Terraform accepts the JSON syntax directly. For generated code like this, I would recommend stopping with the solution you already have and letting the JSON output be the final output, passing that generated configuration directly to Terraform.

Terraform accepts the JSON syntax directly specifically so that you don’t need to implement a native syntax generator, and can just use your favorite language’s JSON library instead.

Thank you @apparentlymart for your response.

I wish I could stop till json. However the .tf (HCL) script is more useful to our customers. They can extend the generated work for future resources.

If there is no tool, I will have give it a try.

Please let me know any projects or tools in your experience to take inspiration from.