Closed maver1ck closed 4 years ago
Not currently supported. What's the use case?
Automatic generation of hcl files by python script. I prefer json dump than custom jinja templates.
Gotcha. I'd be open to a PR for this if it doesn't blow up the complexity of config parsing.
I'd be interested in this as well as we may be looking at automating the creation of the terragrunt.hcl
configuration for a large number of systems.
After a little poking around, it looks like it might be a matter of adding some parsing of the Terragrunt configuration extension and utilizing ParseJSON
from hashicorp/hcl2
https://github.com/hashicorp/hcl2/blob/master/hclparse/parser.go#L74 at https://github.com/gruntwork-io/terragrunt/blob/master/config/config.go#L296 to read in the configuration ?
Would that be the right direction or is there more to consider?
Possibly! ParseJSON
returns an *hcl.File
, so assuming it's the same format we'd get from the HCL parser, then that might work...
Threw together a super quick test at https://github.com/jakauppila/terragrunt/commit/b81197805401f2f2d8cc8ed7535af339edea7c0d and appears to be working fine.
How extensive should the JSON config tests be? Should they just mirror all of the HCL config tests?
Nice! I don't think we need to mirror 100% of the HCL tests, but enough that the major cases are tested: minimal config, full config, config with lots of nesting, any potential data type conversion issues, etc.
Terraform (and HCL parser) support json input file. Is it possible to use json as input to terragrunt ?
https://www.terraform.io/docs/configuration/syntax-json.html