-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Stack Set support #977
Merged
Merged
Conversation
This file contains 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
Create constructs to support the creation of `AWS::CloudFormation::StackSet` resources. Usage: ```typescript // the infrastructure to create in target accounts class AccountAlertTopic extends GuStackForStackSetInstance { constructor(id: string, props: GuStackProps) { super(id, props); new GuSnsTopic(this, "topic-for-alerts"); } } class ParentStack extends GuStackForInfrastructure { constructor(scope: App, id: string, props: GuStackProps) { super(scope, id, props); new GuStackSet(this, `${id}StackSet`, { stackSetInstance: new AccountAlertTopic("Alerts", { stack: props.stack }), name: "centralised-alarms", description: "Provisioning of standard account alerting resources", organisationUnitTargets: [ "o-abcde12345" ] }); } } // contents of `bin/cdk.ts` new ParentStack(new App(), "AccountAlarmResources", { stack: "alarms" }) ``` This will produce a CloudFormation template like this: ```yaml Resources: AccountAlarmResourcesStackSet: Type: AWS::CloudFormation::StackSet Properties: PermissionModel: SERVICE_MANAGED StackSetName: centralised-alarms AutoDeployment: Enabled: true RetainStacksOnAccountRemoval: false Description: Provisioning of standard account alerting resources Parameters: [] StackInstancesGroup: - DeploymentTargets: OrganizationalUnitIds: - o-abcde12345 Regions: - Ref: AWS::Region Tags: - Key: gu:cdk:version Value: TEST - Key: gu:repo Value: guardian/cdk - Key: Stack Value: alarms - Key: Stage Value: INFRA TemplateBody: |- { "Resources": { "topicforalerts57330FBE": { "Type": "AWS::SNS::Topic", "Properties": { "Tags": [ { "Key": "gu:cdk:version", "Value": "TEST" }, { "Key": "gu:repo", "Value": "guardian/cdk" }, { "Key": "Stack", "Value": "alarms" }, { "Key": "Stage", "Value": "INFRA" } ] } } } } ``` See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudformation-stackset.html.
jacobwinch
reviewed
Dec 22, 2021
/** | ||
* A GuStack but designed for Stack Set instances. | ||
* | ||
* In a stack set application, `GuStackForStackSetInstance` is used to represent the infrastructure to provision in target AWS accounts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this naming very clear 👍
jacobwinch
approved these changes
Dec 22, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work 💯
🎉 This PR is included in version 31.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This was referenced Dec 22, 2021
akash1810
added a commit
that referenced
this pull request
Dec 14, 2023
Removes supports for Stack Sets (added in #977) as it's no longer used, because of a lack of CD tooling support for deploying Stack Sets. Removing unused code means less code to maintain, and reduced complexity. Should Stack Sets be needed in future, https://github.com/cdklabs/cdk-stacksets offers an alternative approach to creating them in CDK.
2 tasks
akash1810
added a commit
that referenced
this pull request
Dec 20, 2023
Removes supports for Stack Sets (added in #977) as it's no longer used, because of a lack of CD tooling support for deploying Stack Sets. Removing unused code means less code to maintain, and reduced complexity. Should Stack Sets be needed in future, https://github.com/cdklabs/cdk-stacksets offers an alternative approach to creating them in CDK.
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.
What does this change?
Create constructs to support the creation of
AWS::CloudFormation::StackSet
resources. Unfortunately, AWS CDK does not (yet) have a L2 construct for Stack Sets 😢 .Usage:
This will produce a CloudFormation template like this:
See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudformation-stackset.html.
Note: this does not support provisioning of stack sets to specific accounts as I'm not sure why we'd ever do this.
How to test
See added tests.
How can we measure success?
We get a step closer to a better stack set deployment story as, by provisioning stack sets as just another resource in a CloudFormation template, we're closer to being able to deploy them via RIff-Raff like any other infrastructure.
Have we considered potential risks?
Do the construct names make sense and are they intention revealing enough?
Checklist
Footnotes
Consider whether this is something that will mean changes to projects that have already been migrated, or to the CDK CLI tool. If changes are required, consider adding a checklist here and/or linking to related PRs. ↩
If you are adding a new construct or pattern, has new documentation been added? If you are amending defaults or changing behaviour, are the existing docs still valid? ↩