Note: for support questions, please first reference our documentation, then use Stackoverflow. This repository's issues are intended for feature requests and bug reports.
I'm submitting a ...
What is the current behavior?
If the current behavior is a :beetle:bug:beetle:: Please provide the steps to reproduce
I've a cdk app in typescript that creates a dynamo table, roles, and resolver for graphql. I had one of the variables wrong the deployment failed.
When i ran cdk destroy
i was expected everything in the stack created using the deploy would be deleted but my table was still there. Hence, when i ran deploy
again after destroy
it gave an error that the table was already there
What is the expected behavior (or behavior of feature suggested)?
destroy should also delete the dynamo table
What is the motivation / use case for changing the behavior or adding this feature?
Please tell us about your environment:
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc)
That is the expected behaviour. You need to set the removalPolicy to DESTROY, while creating the table, the default is:
RETAIN
This uses the 'Retain' DeletionPolicy, which will cause the resource to be retained in the account, but orphaned from the stack.
removalPolicy: RemovalPolicy.DESTROY
same goes for s3 buckets btw
Hi @harmohan-a!
As @jimbo5644535 said, this is because of the default RemovalPolicy
is RETAIN
, as outlined here in the documentation.
Let us know if you have any other trouble!
thanks guys
Documentation link in the comment above is broken, here's the link again (I just faced the same 'issue' 馃槃).
Most helpful comment
That is the expected behaviour. You need to set the removalPolicy to DESTROY, while creating the table, the default is:
RETAIN
This uses the 'Retain' DeletionPolicy, which will cause the resource to be retained in the account, but orphaned from the stack.
removalPolicy: RemovalPolicy.DESTROY
same goes for s3 buckets btw