(aws-cdk-lib): (Change terminationProtection on existing Stack instances) #21304
Labels
@aws-cdk/core
Related to core CDK functionality
aws-cdk-lib
Related to the aws-cdk-lib package
effort/small
Small work item – less than a day of effort
feature-request
A feature should be added or improved.
p2
Describe the feature
Currently, the only way to enable termination protection on a CDK Stack is in the props passed to the Stack's constructor, e.g.:
However, there is no way to set termination protection on an existing Stack instance. E.g., in the code above, if I then write
myStack.terminationProtection = false
, then I get the following compiler error:I request that this property be writable.
Use Case
I'm trying to define an Aspect to enable termination protection on all of my production stacks, so that I don't accidentally forget to enable it in the CDK app. I was hoping to define this Aspect as follows, but instead I get the aforementioned compiler error.
Proposed Solution
No response
Other Information
Alternatively, you could take this as a feature request to add an "auto-termination-protection-enabling" Aspect to the CDK itself. 🙂
Acknowledgements
CDK version used
2.33.0 (build 859272d)
Environment details (OS name and version, etc.)
Debian buster (technically in a WSL devcontainer on Windows 11 Pro)
The text was updated successfully, but these errors were encountered: