1

want to read TF files with an node app. Therefore I want to read and parse hcl variable declarations. Is there any way to convert a .tf file to a .tf.json file via terraform cli? I‘ve tried terraform show -json, but this outputs my state without variable declaration.

Gerrit
  • 2,515
  • 5
  • 38
  • 63

1 Answers1

0

I think you should use a dedicated tool for this.

This one comes up in Google search for "nodejs hcl Terraform library":

(I have never seen it before, to be honest)

A general comment - parsing a language like HCL is not a trivial thing.

Grzegorz Oledzki
  • 23,614
  • 16
  • 68
  • 106