-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple keys with the same name #1
Comments
Thanks for the bug report, I'll look into it tomorrow. |
Any progress on this issue? |
Sorry about that, it totally slipped my mind. I'll look at it now. |
Confirmed bug, used hcl2json to generate expected json, will add a test/fix for this. |
Ok, I'm going to step back from this until hashicorp/terraform#807 and hashicorp/hcl#24 are resolved. HCL appears to be conflicted internally about what the output should actually be. |
Just stumbled across this when discussing pyhcl with @phrawzty and we realized that https://github.com/mozilla/socorro-infra/blob/master/terraform/main.tf can't be easily converted to yaml because it's got a large number of resource definitions for the same kinds of resources, and they end up collapsed.
hashicorp/terraform#807 was closed with a fix in terraform and hashicorp/hcl#24 seems to be awaiting code review, but it seems pretty clear that this is going to be a common way that HCL files are written for Terraform. Is there something that can be done to handle this in the mean time? Knowing that pyhcl can handle Terraform configuration files would greatly help me as I could really use it in some Ansible modules I'm working on to help drive Terraform based deploys. |
I have zero bandwidth to work on this until after February 18. Feel free to submit a PR with additional fixtures -- I think more examples need to be created that show this issue and their equivalent in json, so that we can be sure that both hcl and pyhcl are on the same page. |
Here's another example of this issue. There are 2 resources in this template: https://gist.github.com/gposton/27d5f63d2317eb5f75cb But when parsed with pyhcl, the json only includes 1 resource. Here's the output: https://gist.github.com/gposton/3fb0055348b4d8b79147 |
I'm not motivated to fix this at the moment, but I'm happy to accept any PRs that will resolve this issue. |
PR for this here: #6 Excited to see this get in! |
Fixed in #6, pushed to pypi. |
According to: https://github.com/hashicorp/consul-template, HCL supports constructs like the following:
When I parse such a config file using pyhcl (0.18), only the first
template
key is available:The right way would probably to make the key
template
a list within the python dict:The text was updated successfully, but these errors were encountered: