Skip to content
This repository has been archived by the owner on Jun 23, 2021. It is now read-only.

Add DeletionPolicy to DynamoDB table #51

Open
jlhood opened this issue Oct 14, 2019 · 2 comments
Open

Add DeletionPolicy to DynamoDB table #51

jlhood opened this issue Oct 14, 2019 · 2 comments

Comments

@jlhood
Copy link
Contributor

jlhood commented Oct 14, 2019

We should update the DDB table to have DeletionPolicy: Retain. We'd thought of this before launch, but couldn't get to it in time, because it's not quite as trivial as just adding the line to the template. Our integ tests create/teardown a new stack for every integration test run. Adding that DeletionPolicy would mean a DDB table would be left in the account for each integ test run, eventually hitting the table limit. Unfortunately, CFN doesn't support intrinsic functions in DeletionPolicy so we can't make that a prod stage only feature. So the alternative is to update the integ test setup/teardown code to manually delete the DDB table after the stack delete completes.

@benbridts
Copy link

Other options, both are probably worse than a teardown script (but safer, because they rely on CloudFormation for the deletion)

A) Remove the DeletionPolicy from the template before deploying the integration stack (I dislike this option because CloudFormation templates should be treated as (versioned/immutable) artifacts

B) Define the tables twice, once with and once without a DeletionPolicy. Use a condition to only create one of them (this leads to duplicate code and is thus not great either)

C) wait on CloudFormation to support yaml anchors (so the downside of b is gone) or functions in a DeletionPolicy (https://github.com/aws-cloudformation/aws-cloudformation-coverage-roadmap/issues/162)

@jlhood
Copy link
Contributor Author

jlhood commented Oct 14, 2019

@ikben Thanks for the comments and also the reference to the CFN coverage roadmap issue. I'm glad that's being asked for explicitly. That would be the ideal solution IMO.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants