tags Helper
The tags
helper adds several conveniences.
Convenience Form
Provide tags with a simple hash:
tags(Name: "test")
And it conveniently generates the typical CloudFormation Tags property structure.
Tags:
- Key: Name
Value: test
If you prefer to be explicitly you can provide the standard form also. Example:
tags([{Key: "Name", Value: "test"}])
PropagateAtLaunch Special Key
For most resources, the CloudFormation Tags structure is an Array of Hashes with Key
and Value
elements. For the AWS::AutoScaling::AutoScalingGroup TagProperty, there is an additional required key: PropagateAtLaunch
.
The tags
helper method can automatically add PropagateAtLaunch
key to all the Hash elements. Example:
tags(Name: "test", Env: "development", PropagateAtLaunch: true)
Results in:
Tags:
- Key: Name
PropagateAtLaunch: true
Value: test
- Key: Env
PropagateAtLaunch: true
Value: development
Tags Variables Inference
The tags
helper method can also infer it’s value from variables configs. Example:
configs/demo/variables/develpoment.rb:
@tags = {Name: "test", Env: "development"}
Then in the template, call tags
without any arguments to tell it to infer the value from variables.
tags
This generates
Tags:
- Key: Name
Value: test
- Key: Env
Value: development
Edit this page
See a typo or an error? You can improve this page. This website is available on GitHub and contributions are encouraged and welcomed. We love pull requests from you!
- Suggest an edit to this page (here's the contributing guide).
- Open an issue about this page to report a problem.