Skip to content

Commit b0018dc

Browse files
authored
docs(core): fix incorrect default RemovalPolicy documentation (#34934)
### Issue # (if applicable) Closes #23897. ### Reason for this change The documentation for `RemovalPolicy.DESTROY` incorrectly states that it is the default removal policy, when in fact `RETAIN` is the actual default for most resources in the AWS CDK. This creates confusion for users who expect different behavior based on the documentation, potentially leading to unexpected costs or resource retention issues. ### Description of changes Updated the JSDoc comment for `RemovalPolicy.DESTROY` in `removal-policy.ts` to remove the incorrect statement that it is the default removal policy. The comment now accurately describes that this policy will physically destroy resources when applied, without claiming it's the default behavior. **Changes made:** - Modified the JSDoc comment for `DESTROY` enum value to clarify it is not the default removal policy - Ensured consistency with other CDK documentation that correctly states `RETAIN` is the default **Alternatives considered:** - Could have updated all related documentation simultaneously, but this focused change addresses the core issue in the source code - Considered adding explicit mention of what the actual default is, but kept the change minimal to avoid over-documentation **Design decisions:** - Kept the change simple and focused on removing the incorrect information rather than adding extensive explanations - Maintained consistency with existing comment style and format ### Describe any new or updated permissions being added No new or updated IAM permissions are needed for this documentation change. ### Description of how you validated changes - Verified the comment change accurately reflects the actual CDK behavior - Confirmed the change aligns with existing CDK documentation that correctly states `RETAIN` is the default - Reviewed related code in bucket.ts and other resources to ensure consistency - Built and tested locally to ensure no compilation issues ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent e0ac9f8 commit b0018dc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/aws-cdk-lib/core/lib/removal-policy.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@
2727
*/
2828
export enum RemovalPolicy {
2929
/**
30-
* This is the default removal policy. It means that when the resource is
31-
* removed from the app, it will be physically destroyed.
30+
* When this removal policy is applied, the resource will be physically destroyed
31+
* when it is removed from the stack or when the stack is deleted.
3232
*/
3333
DESTROY = 'destroy',
3434

3535
/**
3636
* This uses the 'Retain' DeletionPolicy, which will cause the resource to be retained
3737
* in the account, but orphaned from the stack.
38+
* Most resources default to this removal policy.
3839
*/
3940
RETAIN = 'retain',
4041

0 commit comments

Comments
 (0)