-
Notifications
You must be signed in to change notification settings - Fork 727
Nuke CloudFormation stacks first #238
Comments
I am not sure how this actually would improve the wait times. At least not in a way that would justify the increasing code complexity. Currently Are there actually so many resources in your scenario, that the first run takes so long? Am I missing something else? Any other opinions @rebuy-de/prp-aws-nuke? |
I am not sure it would make a drastic difference -- but it seems logical to terminate CloudFormation stacks first, since this would in turn terminate any resources they launched cleanly. |
Only issue I came across is, if awsnuke deletes the resources first even before the CFN stack is deleted, the CFN stack deletion fails saying it is unable to find the resource to delete and gets stuck in Deletion failed status. This is keeping awsnuke to go in loop and retry deleting CFN stack over and over. The moment I manually deleted CFN stack nuke job completed. |
Logical yes, but I am concerned about the increased complexity. Also the code base is currently very messy and adding more stuff would make it worse.
That sounds like a bug to me. If you are able to delete it manually, aws-nuke should also be able to delete it. We should take a look into this. |
I usually delete CFN stacks first, too. Reason being: I already ran into the situation that the role that was used to create the CFN stack was nuked before the stack. IIUC the role used to create a stack is used to destroy it as well. If you have CodePipelines that create/update CFN stacks they will have a certain role for doing that. If that role gets nuked before the stacks get nuked - those stacks are not deleteable by aws-nuke anymore. Cheers, Christian. (At least this has been the case a couple of weeks ago) |
After some internal discussion, there is the proposal to delete CF stacks first in a separate run (ie before actually scanning all other resources). What are your thoughts on this? |
I like this idea
…Sent from my iPhone
On Aug 10, 2018, at 5:25 AM, Sven Walter ***@***.***> wrote:
After some internal discussion, there is the proposal to delete CF stacks first in a separate run (ie before actually scanning all other resources). What are your thoughts on this?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
PTAL: #242 |
Hi, when deleting CFN stacks first you have to consider that an CFN stack might not be deleted successfully when a controlled resource depends on something that was changed manually. An example for this is:
The implementation should be fine when it deletes the CFN stacks with ignoring depending resources that cannot be deleted and after that deletes those resources using the concerning routine. Does you implementation already consider this? |
The solution proposed in #242 is that just the CFS is deleted and the resources that were created by it will be left intact by the CFS resource implementation.
Is something that would not happen this way. The resources that are retained from the CFS should be deleted by their own resource implementation (like any other resource in aws-nuke). |
Works for me! |
hi @leozhad @svenwltr Does aws-nuke behave like this by default, or do i need to add certain configuration to achieve this? |
Hello @adamcousins, aws-nuke does not do this, but it should not matter. Why do you want to delete the CF Stacks before anything other? |
@svenwltr aws-nuke deleted a resource before CFN had the chance to (Elastic IP in my case). The CFN stack now will not delete as it cant find the EIP resource its trying to delete. Cloudformation delete workload then expect the user to 'ignore' any resource errors to continue the delete action. Is it possible using filters to instruct aws-nuke to 'target' these types of resources first CFN stacks, then anything else? |
The deletion of the CloudFormation stack should not fail in this case. The issues should be solved with #424. |
I would like to suggest that aws-nuke should nuke any existing CloudFormation stacks before anything else, when running on an account. This way, they will terminate any resource launched by those stacks, and cut down on wait times that would occur on if you terminate other resources first.
The text was updated successfully, but these errors were encountered: