Closed NadOby closed 4 years ago
From Hashicorp:
At some point we'll likely have to roll the HCL2 codebase into that one, having two versions of HCL is something we'll likely maintain for a little while as customers migrate across from 0.11 to 0.12. However HCL2 will be our definitive version of HCL and will supersede the original repo at some point in the future. We just don't have a hard date for that as we've never EOL'd a version of Terraform so we don't have concrete plans for when we'll do that.
I don't see how will be possible to update HCL=>HCL2 grammar easily. There is no formal specification of the grammar that can be used outside of hashicorp grammar is spread in https://github.com/hashicorp/hcl2/tree/master/hcl/hclsyntax
For now I workaround this problem by not using terraform 0.12upgrade
old syntax works in terraform v0.12, but this took some time.
As a user of pyhcl
I would expect pyhcl's API to be something like hcl.load(input_tf_file, hcl_version=1)
for loading pre-0.12 Terraform and hcl.load(other_tf_file, hcl_version=2)
for loading 0.12-compatible files. (with version
defaulting to 2 going forward).
Of course somebody then needs to do the work of figuring out how to parse HCL2 files. Easier said than done. 😓
If you don't want to wait for the pull request, try out the code in my fork: https://github.com/StateFarmIns/pyhcl
@sbalbach, thanks for working updates that support HCL2 and Terraform v0.12. Do you think you'll add support for "for" and "for-each"?
@jcaxmacher: what kind of support are you looking for? i.e. are you getting an error?
@sbalbach when will this fix be merged in to pyhcl?
@cr-liadsh someone needs to fix the unit tests as mentioned in the PR. I'm not going to merge it if it's obviously incorrect.
It isn't just the unit tests. To fix the unit tests, the code must be changed. I'm in a catch 22. If I fix it for the unit tests, it breaks it elsewhere. So, I don't plan to make further changes.
Someone else is free to give it a shot, though.
Steps to reproduce: upgrade terraform to latest version.