jjcollinge / terraform-deploy-to-azure

MIT License
12 stars 3 forks source link

Investigate parsing and extracting variables from Terraform client side #9

Closed jjcollinge closed 5 years ago

jjcollinge commented 6 years ago

It would speed up the launch process if we could parse the terraform files in the client rather than in the deployer.

jjcollinge commented 6 years ago

Using isomorphic git with a BrowserFS backend we could clone the git repository, then use hcl-to-json to convert all *.tf files into JSON and then merge them, extract the variables and then build the variables page dynamically.

lawrencegripper commented 6 years ago

Oooh interesting. The bit which might be harder than you'd expected would be working out which of the 'variable' fields are required and which aren't as you may have nested modules with variables but these are provided by the top level module.

Actually this would be fine as long as you only looked at vars in the top level directory as all modules have to be in sub directories.

I think this is doable, clone the repo, convert all HCL in the top level dir to JSON then walk the json for the variable fields. If they have a default option set mark them as "optional"

lawrencegripper commented 5 years ago

closed by #10