aws-cli
aws-cli copied to clipboard
Add AWS::CloudFormation::Stackset resource to cloudformation package command
Issue #, if available: #5590
Description of changes:
This PR enables the aws cloudformation package command to package the AWS::CloudFormation::Stackset resource.
It defines the CloudFormationStacksetResource class in artifact_exporter.py. This is an extension of the CloudFormationStackResource class.
I have also updated the docs.
Before this is merged, I debated whether a test should be added to tests/unit/customizations/cloudformation/test_artifact_exporter.py.
I would appreciate some guidance on whether this is necessary.
Here is an example snippet of the template, and output after the packaging command
# template.yaml
MainStackSet:
Type: AWS::CloudFormation::StackSet
Properties:
StackSetName: example-stackset
PermissionModel: SELF_MANAGED
TemplateURL: ./main.yaml
Capabilities:
- CAPABILITY_IAM
StackInstancesGroup:
- Regions:
- us-east-1
DeploymentTargets:
Accounts:
- !Ref AWS::AccountId
#packaged.yaml
MainStackSet:
Type: AWS::CloudFormation::StackSet
Properties:
StackSetName: example-stackset
PermissionModel: SELF_MANAGED
TemplateURL: https://s3.eu-west-2.amazonaws.com/example-bucket/stackset-test/9a8c1dca11fcd0938d8eb3b6850e9d9c.template
Capabilities:
- CAPABILITY_IAM
StackInstancesGroup:
- Regions:
- us-east-1
DeploymentTargets:
Accounts:
- Ref: AWS::AccountId
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Codecov Report
Merging #5591 into develop will increase coverage by
0.00%. The diff coverage is100.00%.
@@ Coverage Diff @@
## develop #5591 +/- ##
========================================
Coverage 92.51% 92.51%
========================================
Files 196 196
Lines 15890 15893 +3
========================================
+ Hits 14701 14704 +3
Misses 1189 1189
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...customizations/cloudformation/artifact_exporter.py | 98.67% <100.00%> (+0.01%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update dabd57b...4fe7c72. Read the comment docs.
I confirm that it works!
The only issue I encountered with this solution, is that it potentially packs nested stacks inside the StackSet which is not supported by the CloudFormation itself:
Invalid request provided: Nested AWS::CloudFormation::Stack is not supported in AWS::CloudFormation::StackSet
CloudFormation provides a good error message, so it seems to be not a big deal that user discovers it only on the deployment step. Usage of CloudFormationStackResource parent class still seems to be justified, because nested stack may contain Lambdas and other uploadable dependencies.
Codecov Report
Merging #5591 (bf43fed) into develop (dabd57b) will decrease coverage by
0.52%. The diff coverage is100.00%.
@@ Coverage Diff @@
## develop #5591 +/- ##
===========================================
- Coverage 92.51% 91.98% -0.53%
===========================================
Files 196 196
Lines 15890 15902 +12
===========================================
- Hits 14701 14628 -73
- Misses 1189 1274 +85
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...customizations/cloudformation/artifact_exporter.py | 98.00% <100.00%> (-0.66%) |
:arrow_down: |
| awscli/customizations/putmetricdata.py | 88.88% <0.00%> (-11.12%) |
:arrow_down: |
| awscli/customizations/ec2/addcount.py | 84.00% <0.00%> (-10.00%) |
:arrow_down: |
| awscli/customizations/streamingoutputarg.py | 89.65% <0.00%> (-8.63%) |
:arrow_down: |
| awscli/customizations/ec2/decryptpassword.py | 79.36% <0.00%> (-6.35%) |
:arrow_down: |
| awscli/customizations/s3/utils.py | 92.76% <0.00%> (-5.35%) |
:arrow_down: |
| awscli/customizations/s3/filegenerator.py | 94.05% <0.00%> (-4.87%) |
:arrow_down: |
| awscli/customizations/commands.py | 94.75% <0.00%> (-4.81%) |
:arrow_down: |
| awscli/customizations/arguments.py | 95.23% <0.00%> (-4.77%) |
:arrow_down: |
| awscli/customizations/paginate.py | 93.93% <0.00%> (-3.79%) |
:arrow_down: |
| ... and 22 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update dabd57b...e64cb85. Read the comment docs.
Any way this can get merged? The related issue has 13 👍 and this was originally approved in Oct 2020?
Codecov Report
Merging #5591 (31757ea) into develop (23e4b4f) will increase coverage by
0.00%. The diff coverage is100.00%.
@@ Coverage Diff @@
## develop #5591 +/- ##
========================================
Coverage 92.87% 92.87%
========================================
Files 204 204
Lines 16329 16332 +3
========================================
+ Hits 15166 15169 +3
Misses 1163 1163
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...customizations/cloudformation/artifact_exporter.py | 98.67% <100.00%> (+0.01%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 23e4b4f...31757ea. Read the comment docs.
Apologies for the delayed response. I've rebased the PR branch onto the latest develop branch to take care of the existing merge conflicts and run the latest CI tests.
Our team just put out a contribution guide detailing improvements to the contribution process. This PR looks like it falls under the "Ready for Review" stage. At the moment, our team is working through the PR/Issue backlog to determine where each PR belongs in our updated contribution process. After that, a maintainer will take a closer look at this PR.
Hi guys, it's been 2 years already. Is there any chances the MR will be deployed? Thank you
@thanhthai3010 fyi the packaging works fine for this usecase via sam-cli if you're looking for a "workaround" ;)
https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-package.html
@thanhthai3010 fyi the packaging works fine for this usecase via sam-cli if you're looking for a "workaround" ;)
https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-package.html
hi @steenda, thank you so much for replying, let me check the information.
Hi @ConnorKirk, thanks for this PR and for your patience on hearing back. After bringing this up to discuss with the team, we've decided to set this PR as a draft and continue tracking this feature. We'll also be leaving the issue (https://github.com/aws/aws-cli/issues/5590) open for tracking. As a workaround, I'd recommend taking a look at the SAM CLI, which does have support for this resource. Thanks!
Thanks Ryan 🙂
Are there changes required, or just not able to proceed with it at the moment?
I am using the SAM CLI as a workaround, but some customers can't/don't use SAM CLI. This feature (and parity for the rest of the aws cloudformation package resources would be useful for them.
No changes required at the moment.
@RyanFitzSimmonsAK can we get this PR merged, the suggested workarounds are not sufficient?