-
Notifications
You must be signed in to change notification settings - Fork 4k
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(core): set (default) stack termination protection on (parent) stage level #33239
base: main
Are you sure you want to change the base?
feat(core): set (default) stack termination protection on (parent) stage level #33239
Conversation
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.
(This review is outdated)
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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.
This is a new pull request, since the #31450 did not receive any activity/communication and had some CI quality gate check issues, so trying again if this time there's a change for getting this merged!
Sorry for that 😢 Left comments for minor adjustments. Otherwise LGTM!
You can also set termination protection via any parent stage and it will be inherit by all child stacks (unless overridden on stack level): | ||
```ts | ||
const stage = new Stage(app, 'StageName', { | ||
terminationProtection: true, | ||
}); | ||
const stack = new Stack(stage, 'StackName', {}); | ||
``` |
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.
You can also set termination protection via any parent stage and it will be inherit by all child stacks (unless overridden on stack level): | |
```ts | |
const stage = new Stage(app, 'StageName', { | |
terminationProtection: true, | |
}); | |
const stack = new Stack(stage, 'StackName', {}); | |
``` | |
You can also set termination protection via any parent stage and it will be inherited by all child stacks (unless overridden on stack level): | |
```ts | |
const stage = new Stage(app, 'StageName', { | |
terminationProtection: true, | |
}); | |
const stack = new Stack(stage, 'StackName', {}); |
/** | ||
* Whether to enable termination protection for stacks in this stage. | ||
* | ||
* @default - The termination protection should be configured on the `Stack`s. |
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.
* @default - The termination protection should be configured on the `Stack`s. | |
* @default - The termination protection configured on the child `Stack`s. |
@@ -337,6 +337,64 @@ describe('stage', () => { | |||
}); | |||
}); | |||
|
|||
test('Stack inherits termination protection from Stage', () => { |
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.
Can you please move these to the describe('stage')
section?
Issue
Closes #31449.
This is a new pull request, since the previous one did not receive any activity/communication and had some CI quality gate check issues, so trying again if this time there's a change for getting this merged!
Reason for this change
New feature: Enable setting Stack (default) termination protection on (parent)
Stage
level.Description of changes
Changes to
cdk.Stage
:terminationProtection
intoStageProps
terminationProtection
property from parent stage, but also it can be overriden by child StagesChanges to
cdk.Stack
:terminationProtection
from parent Stage – unless overriden on Stack levelterminationProtection
is not set in the Stack level or in any of its parent Stages, the value will default tofalse
as before – hence this is NOT a breaking change.Describe any new or updated permissions being added
None.
Description of how you validated changes
I've originally done a PoC in my own codebase (by extending
cdk.Stage
).After modifications into aws-cdk codebase:
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license