Convert pkrvars.json to pkrvars.hcl
- Dominant language
- Go
- Stars
- 15.8k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
#### Community Note
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
Please search the existing issues for relevant feature requests, and use the
reaction feature
(https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)
to add upvotes to pre-existing requests.
#### Description
Convert foo.pkrvars.json to foo.pkrvars.hcl with packer hcl2_upgrade command. Or just generally it could also be described as supporting conversion from json to hcl for any of the various json file types that packer can read now. That would probably be better.
#### Use Case(s)
I'm generating my pkrvars variable files from ansible and it's relatively easy to output json with the `to_json` filter for ansible. However, there is no such thing as a `to_hcl` filter. If I could then run packer hcl2_upgrade foo.pkrvars.json and it would generate foo.pkrvars.hcl that would help a lot. It's not really just this use case but probably dozens of sources will output json but nothing really supports hcl except packer and terraform.
Contributor guide
Research direction
The request centers on the packer hcl2_upgrade command; start by tracing its current input handling and the JSON file types it accepts. Define whether pkrvars.json is in scope or whether all supported JSON inputs should convert, then verify that the command produces valid equivalent HCL output for representative inputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- json
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100