Warn users of DELETE_SKIPPED events
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
## :rocket: Feature Request
### General Information
* [ ] :wave: I may be able to implement this feature request
* [ ] :warning: This feature might incur a breaking change
### Description
The default removalPolicy for resources that have this property is to orphan the resource. Users who are accustomed to using CloudFormation and are used to a "try to delete, then manually resolve any delete issues" may be caught unaware of this behavior. I understand the reasoning behind using this as a default within cdk, but if a user is unaware of this it can cause orphaned resources that cost $.
### Proposed Solution
I see two options here, but am not sure of which is most feasible within cdk:
1. Examine the resources for any that have a removalPolicy of `RemovalPolicy.RETAIN` that will be orphaned by the changeset and prompt the user to continue (similar to IAM changes).
2. Parse the events for the user and callout any DELETE_SKIPPED events a bit better.
### Environment
- **CDK CLI Version:** 1.4.0 (build 175471f)
- **Module Version:** 1.5.0
- **OS:** OSX Mojave
- **Language:** TypeScript
### Other information
Here's a recent example that I've hit. If a user creates a new CodePipeline:
```
new codepipeline.Pipeline(this, {...});
```
This will, by default, create a new S3 bucket for it's artifacts and a Customer Managed KMS key to use for encryption. If the user sees this and decides to use an existing managed key instead, they have to explicitly create the bucket and specify the key:
```
const encryptionKey = Key.fromKeyArn(this, 'awsManagedS3Key', Fn.sub('arn:aws:kms:${AWS::Region}:${AWS::AccountId}:alias/aws/s3'));
const artifactBucket = new s3.Bucket(this, 'artifactBucket', { encryptionKey });
new codepipeline.Pipeline(this, 'ServicePipeline', { artifactBucket, ... });
```
On the next deploy, CloudFormation will create a new S3 bucket referencing the existing key, but will skip deleting the old bucket and KMS key. Unless the user watches closely for `DELETE_SKIPPED` from the CloudFormation events, the user will be unaware of what happened, leaving resources that can accumulate cost over time.
Contributor guide
Research direction
No source file, test, or entry point is named. Start by locating the CDK CLI deploy handling for CloudFormation events and determine how DELETE_SKIPPED events are currently surfaced. Done means selecting and implementing a clear warning or prompt behavior, with tests covering the reported orphaned-resource scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cli, cloud
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100