aws/aws-cdk

core: add RemovalPolicyOptions parameter to L2 applyRemovalPolicy method

Open

#22.077 aperta il 16 set 2022

Vedi su GitHub
 (15 commenti) (0 reazioni) (0 assegnatari)TypeScript (3530 fork)batch import
@aws-cdk/coreeffort/smallfeature-requestgood first issuep2

Metriche repository

Star
 (10.710 star)
Metriche merge PR
 (Merge medio 14g 11h) (68 PR mergiate in 30 g)

Descrizione

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

Guida contributor