aws-cloudformation / rain

A development workflow tool for working with AWS CloudFormation.
Apache License 2.0
749 stars 69 forks source link

Rain fmt not able to resolve anchors #440

Open dd-924 opened 1 week ago

dd-924 commented 1 week ago

I currently use cfn-flip to convert Cloudformation templates from YAML to JSON and migrating to rain after cfn-flip's deprecation notice. After some testing with rain I noticed that fmt does not work when anchors are present and trying to convert to JSON. This error will be thrown when running rain fmt <filename> -j:
yaml: unknown anchor 'testAnchor' referenced

After looking at issue #265, I see that it's possible to run rain pkg then rain fmt to achieve the desired result after adding in the --unsorted flag, but it would be nice to convert a YAML file JSON after resolving anchors without having to run rain pkg first.