sparkleformation / sfn

SparkleFormation CLI
http://www.sparkleformation.io
Apache License 2.0
63 stars 24 forks source link

destroy succeeds erroneously although stack in delete failed #288

Closed universam1 closed 5 years ago

universam1 commented 5 years ago

sfn command should, but does not return with exit code of != 0 when a stack is in delete failed

Example:

Fetching sparkle_formation 3.0.32
Installing sparkle_formation 3.0.32
Using sfn 3.0.32
Using sfn-parameters 0.3.0
Bundle complete! 8 Gemfile dependencies, 48 gems now installed.
....
bundle exec sfn destroy testStack --yes
[Sfn]: Callback after_config parameters_stacks: starting
[Sfn]: Callback after_config parameters_stacks: complete
[WARN]: Destroying Stack: testStack
[Sfn]: Destroy request complete for stack: testStack
[Sfn]: Callback after_config parameters_stacks: starting
[Sfn]: Callback after_config parameters_stacks: complete
[Sfn]: Events for Stack: testStack
Time                      Resource Logical Id     Resource Status      Resource Status Reason   
2018-12-26 22:02:53 UTC   testStack   DELETE_IN_PROGRESS   User Initiated           
...
2018-12-26 22:06:40 UTC   LoadBalancerS3BucketPolicy                DELETE_COMPLETE                               
2018-12-26 22:06:41 UTC   LoadBalancerS3Bucket   DELETE_IN_PROGRESS                                                                          
2018-12-26 22:06:41 UTC   LoadBalancerS3Bucket   DELETE_FAILED        The bucket you tried to delete is not empty (Service: Amazon S3; Statu 
                                                                      s Code: 409; Error Code: BucketNotEmpty; Request ID: EFDF...06FDD6; 
                                                                       S3 Extended Request ID: qViTip+QBFiKM1....r87N1IJIXWrqES5GYG 
                                                                      KzzJabOqMFppceHTP5IHD9yALrl0JM=)                                       
2018-12-26 22:07:24 UTC   ALBSecurityGroup        DELETE_COMPLETE                                                                             
2018-12-26 22:07:25 UTC   testStack   DELETE_FAILED        The following resource(s) failed to delete: [LoadBalancerS3Bucket].    
[Sfn]:   -> Destroyed SparkleFormation: testStack

exit code 0

This becomes a problem in pipelines since the stacks are left in a 'Delete Failed' state and not cleaned up

chrisroberts commented 5 years ago

Thanks for the report!

webframp commented 5 years ago

Thanks @chrisroberts! This is a big help for our ci/cd usage.

universam1 commented 5 years ago

Thanks so much!