Closed braxtone closed 6 years ago
pyhcl only consumes HCL and does not do application-specific interpolation such as terraform does (nor should it, as this is application-specific).
I would recommend creating your own library (perhaps call it pyterraform?) with this functionality, I'm sure other terraform users would find it quite useful.
Thanks for the response. You wouldn't happen to know if there are other projects that already do this would you?
I don't know of any, no.
Worth a shot. It looks like terraform_validate has a substitute_variable_values_in_string
method that's close enough to duplicate for locals expansion. Thanks for the great library to build off of!
I'm using locals in my main.tf file for tagging values and then using them to simplify tagging of other resources like so:
When I try to use pyhcl to parse the hcl/tf files, it doesn't resolve them, and instead includes them as strings:
Expected behavior:
Is there another way to get pyhcl to traverse a whole project and do this translation like the terraform cli does? Thanks!