Closed clushie closed 9 months ago
I think there's a bug in your script: yj yc | yj yy
outputs HCL and tries to parse it as YAML.
There is a small difference if you convert from YAML to HCL and back to YAML:
route:
receiver: webhook
group_by:
- alertname
- datacenter
- app
receivers:
- name: webhook
webhook_configs:
- url: http://localhost:500
- url: http://localhost:500
route: # route is now an array
- receiver: webhook
group_by:
- alertname
- datacenter
- app
receivers:
- name: webhook
webhook_configs:
- url: http://localhost:500
- url: http://localhost:500
But this is expected, as HCL's object syntax is also used to express an array of objects.
(private account as I'm on vacation): Ah totally right, I mixed things up when I created the final script in a hurry. You definitively posted the right output though.
Is there a way to avoid the conversion from dict to an array?
I'm trying to pass yaml/json inside terraform and try to avoid having to do in-line json/yaml.
Also do you think its worth mentioning this behavior somewhere in the readme?
Hi! I'm running into an issue where converting from YAML to HCL is kind of destructive, with json the issue doesn't show up.
Results in this output: