text templating nested maps #3453
Unanswered
hansbogert
asked this question in
Q&A
Replies: 1 comment 4 replies
-
|
I have some Y answers to your X question, if you'll forgive me. Are you sure you need to export to HCL? All the Hashicorp products accept json in addition to hcl files. You could export to json with encoding/json and then use json directly. Another alternative, you could export to json and then use a json to hcl2 tool. Here are a few I found of unknown quality: |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to pretty print a nested map something like this:
However with the current text/template, I think I don't have enough mechanisms to know when to make a recursive call because I can't check if a variable is of type map.
How would you implement a pretty printer for a nested map of unknown depth?
For context, I'm trying to pretty print to Terraform's HCL2 syntax. So maybe there's a better approach in the first place
Beta Was this translation helpful? Give feedback.
All reactions