Skip to content

Unroll YAML anchors in cloudformation package - #3827

Merged
JordonPhillips merged 1 commit into
aws:developfrom
JordonPhillips:resolve-anchors
Jan 4, 2019
Merged

JordonPhillips merged 1 commit into
aws:developfrom
JordonPhillips:resolve-anchors

Conversation

@JordonPhillips

Copy link
Copy Markdown
Member

This updates the YAML dumper for the package command to ignore aliases
/ anchors. For context, YAML lets you do something like:

Foo: &anchor
  Bar: Baz
Bin:
  <<: *anchor
  Spam: Eggs

Which will result in the Bin key being a copy of the Foo key, but
with an additional member Spam. CloudFormation won't accept
templates that contain these, but they can be useful in the cases
where CloudFormation conditions aren't supported, causing you to have
to duplicate a resource with one or two changes.

With this change users can write their template using anchors and then
call package to resolve them along with anything else package needs to
do.

Inspired by #3825

This updates the YAML dumper for the package command to ignore aliases
/ anchors. For context, YAML lets you do something like:

```yaml
Foo: &anchor
  Bar: Baz
Bin:
  <<: *anchor
  Spam: Eggs
```

Which will result in the `Bin` key being a copy of the `Foo` key, but
with an additional member `Spam`. CloudFormation won't accept
templates that contain these, but they can be useful in the cases
where CloudFormation conditions aren't supported, causing you to have
to duplicate a resource with one or two changes.

With this change users can write their template using anchors and then
call package to resolve them along with anything else package needs to
do.
@codecov-io

codecov-io commented Jan 3, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #3827 into develop will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3827      +/-   ##
===========================================
+ Coverage    94.42%   94.42%   +<.01%     
===========================================
  Files          186      186              
  Lines        14049    14052       +3     
===========================================
+ Hits         13266    13269       +3     
  Misses         783      783
Impacted Files Coverage Δ
awscli/customizations/cloudformation/yamlhelper.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d1ff874...2380727. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants