-
Notifications
You must be signed in to change notification settings - Fork 56
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
Support python hcl2 object to hcl2 text #23
Comments
I think the terraform json syntax is preferred for machine generated code. That would be much easier to implement than going back to HCL2. |
hey @danieladams456 , that is true but it is still a good idea to have the option to convert the dict back to hcl2. In my use case, I am not converting all my |
It would be great to have possibility to write HCL back to a file. Imagine one wants to parse something during CI/CD phase and commit it back to GitHub after, while still having neat HCL code. Not a nasty JSON :) |
+1 for having this feature. It would be great to have this feature as you say, but from what I see here: python-hcl2/hcl2/transformer.py Lines 188 to 189 in 64a3d8b
The comments are simply ignored, so we can't really combine an updated file from the The only solution which can do correct manipulation is the official Go library - https://github.com/hashicorp/hcl/tree/hcl2 . Please correct me if I am wrong and you know another solution (preferably in Python). |
+1 In my case, I want to dynamically update a |
ChatGPT brought me here. It keeps suggesting I use hcldumps to convert the json back to HCL - no doubt because of this thread. :D |
This is my current work around https://nklya.medium.com/how-to-write-hcl2-from-python-53ac12e45874 |
any news here? :) |
any news here? |
Hi everyone! I've implemented a big first step in this direction in my PR #169. While this wouldn't allow you to directly convert a dictionary back to HCL, it does allow you to manipulate an AST (produced by this library) in Python code and convert that back to HCL. See my PR for more details. |
Hey everyone. |
@kkozik-amplify I have an experimental branch in the works for going from dict to HCL2 as well - I will share a PR (or draft PR) for that when I make a bit more progress :) |
Is there any plan to support going backwards (from dict to hcl2)?
Something like this:
The text was updated successfully, but these errors were encountered: