aws-cdk CLI - strange order of stack deletion #31699
Unanswered
antonostrovsky
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hi @antonostrovsky , AFAIK, the order of stack deletion is determined by the dependency between stacks , not the order of declaration. CloudFormation first deletes the stacks that do not have any dependencies on other stacks. Then it deletes the stacks that depend on the stacks that were just deleted, and so on until all stacks are deleted. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi CDK gurus!
We have encountered a strange condition where the order of stack declarations in CDK code appears to control stack destruction order. Example:
When I issue
bb cdk destroy stagingPdxEc2Stack
I get:and when responding "Yes" we get:
However! When I change the order of declarations to:
the output of
bb cdk destroy stagingPdxEc2Stack
changes :And now the deletion happens without the dependency problem.
We know of the existence of .addDependency, but we just really want someone to confirm that the order of stack declarations in the code affects the order of deployment/destruction. I've found this commit that controls this in aws-cdk, but I am not sure if this behaviour is normal.
Please advise, and thank you in advance!
Beta Was this translation helpful? Give feedback.
All reactions