CloudFormation: don't propagate stack tags to launch templates - #10200
Open
Mide69 wants to merge 3 commits into
Open
CloudFormation: don't propagate stack tags to launch templates#10200Mide69 wants to merge 3 commits into
Mide69 wants to merge 3 commits into
Conversation
AWS::EC2::LaunchTemplate exposes tags via TagSpecifications (nested under LaunchTemplateData), not a top-level Tags property, so real CloudFormation does not auto-tag it with the stack's tags the way it does for other taggable EC2 resources. Excludes LaunchTemplate from the generic tag-propagation loop in the stack resource map. Closes getmoto#10168.
The regression-guard VPC lookup filtered by CidrBlock (10.0.0.0/16), a value reused across many tests in the suite. That's harmless under mock_aws's per-test isolation, but server-mode tests share one long-lived backend across the whole run, so the filter could match a different test's VPC instead of this stack's own one. Read the physical resource id from the stack's own resources instead.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10200 +/- ##
=======================================
Coverage 93.31% 93.31%
=======================================
Files 1341 1341
Lines 122557 122558 +1
=======================================
+ Hits 114361 114362 +1
Misses 8196 8196
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10168.
AWS::EC2::LaunchTemplateexposes tags viaTagSpecifications(nested underLaunchTemplateData), not a top-levelTagsproperty, so real CloudFormation does not auto-propagate the stack's tags to it the way it does for other taggable EC2 resources (AWS docs).Root cause:
LaunchTemplateinheritsTaggedEC2Resource, so the generic tag-propagation loop inResourceMap.create()(moto/cloudformation/parsing.py) was callingcreate_tags(...)on it just like any other taggable EC2 resource. ExcludesLaunchTemplatefrom that loop.Note:
describe_launch_templates'sTagsfield wasn't actually showing the leak (it's a snapshot taken at construction time, before the CFN tag loop runs), the leaked tags were only visible via the genericdescribe_tagsAPI on the launch template's resource id. Test reflects that, and also verifies a normal taggable resource (VPC) still gets stack tags as a regression guard.