aws / aws/aws-cdk

aws-cdk: be able to change default settings for what resources to retain and destroy

Open
#28,183 6 comments 1 reaction 1 assignee Claimed by @scanlonp View on GitHub
@aws-cdk/core effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

Basically in cdk.json we add a new setting:

```
"destroyResources": ["DynamoDBTables", "IAMRoles", "CloudwatchDashboards"]
```

to change the default behavior of these resources.

### Use Case

This allow us not to have to hardcode everywhere:

````
role.applyRemovalPolicy(RemovalPolicy.DESTROY)
````

The main motivation is for Region Build Automation.

Disclosure: I work at AWS Redshift and we use extensively the aws-cdk. I've noticed that destroying failed stacks that got half created is a huge pain and consumption of time. There should be a easy way to set some setting that allows all resources to be deleted easily if the stack is not a production stack.

For example for new regions that don't yet serve production traffic you don't want to have a huge pain of deleting resources. You want to be able to delete those stacks easily and not to have to fight through all the "termination protection errors" and "this resource has to be deleted manually". This is really a productivity killer.

### Proposed Solution

_No response_

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

v2

### Environment details (OS name and version, etc.)

typescript amazon-linux

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.