core: add RemovalPolicyOptions parameter to L2 applyRemovalPolicy method
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the feature
The `applyRemovalPolicy` method signature for L1 resources is:
`CfnResource.applyRemovalPolicy(policy: cdk.RemovalPolicy, options?: cdk.RemovalPolicyOptions): void`
For L2 resources it is:
`Resource.applyRemovalPolicy(policy: cdk.RemovalPolicy): void`
It would be nice to be able to pass the options in for L2 resources, and since the L2 method is just a wrapper for the L1 method, it should be trivial to do so.
### Use Case
This is mainly a limitation when I need to set the `applyToUpdateReplacePolicy` option to false, which is actually quite often
### Proposed Solution
Just add the options parameter here: https://github.com/aws/aws-cdk/blob/2e797b5a37c69561b42cbe07fe2144af41833e00/packages/%40aws-cdk/core/lib/resource.ts#L231
And pass it in here: https://github.com/aws/aws-cdk/blob/2e797b5a37c69561b42cbe07fe2144af41833e00/packages/%40aws-cdk/core/lib/resource.ts#L236
### Other Information
Great first PR
### Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
2.41.0
### Environment details (OS name and version, etc.)
Windows 10 Enterprise Version 10.0.19044
Contributor guide
Research direction
Open packages/@aws-cdk/core/lib/resource.ts and read the L2 applyRemovalPolicy method at the referenced location, then compare it with the L1 signature and delegation. The change is complete when L2 accepts the optional RemovalPolicyOptions value and forwards it to the underlying L1 resource; the payload does not name a test file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100