Cloudformation-coverage-roadmap: Support YAML anchors/aliases in CFN yaml templates

Created on 24 Aug 2020  路  2Comments  路  Source: aws-cloudformation/cloudformation-coverage-roadmap

Doesn't really fit the issue template, but it would be great if CFN YAML templates would allow to use YAML anchors & aliases.

This way one could simply set an anchor and then refer back to it in other places of the template.

Example (non-cfn - only to demonstrate anchors/aliases)

a: &numbers
- 1 
- 2
- 3

b: *numbers

is the same as

a:
- 1 
- 2
- 3

b:
- 1 
- 2
- 3

Advantages:

  • less copy & paste
  • less errors when changing a thing (think subnet lists) in one place, but forget to in another
  • reusability of computed values (Fn::Join, Fn::Sub, Fn::Cidr)
enhancement

Most helpful comment

This would be huge. Not sure why it's not available already.

All 2 comments

This would be huge. Not sure why it's not available already.

My use case: I have two stacksets in a parent stack. The stacksets have various configuration properties that should be the same: PermissionModel, AutoDeployment, OperationPreferences, CallAs, Capabilities.

A YAML anchor would be a very simple way to keep this configuration DRY ("don't repeat yourself").

Without an anchor, I think my deduplication options are to use a substack to encapsulate the the common configuration or to generate the deployed template from another source.

In my case I don't want to add that complexity, I really just want to have a single template file (even the stackset template body is defined inline with TemplateBody!).

So for now I have to live with the duplicatation with a comment to the effect of "These settings should be the same for each stack". :smile:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fimbulvetr picture fimbulvetr  路  3Comments

hoegertn picture hoegertn  路  4Comments

baxang picture baxang  路  3Comments

kjpgit picture kjpgit  路  4Comments

grauj-aws picture grauj-aws  路  3Comments