Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloudformation delete-stack to return error when Stack does not exist #6302

Closed
mssokal opened this issue Jul 29, 2021 · 2 comments
Closed

cloudformation delete-stack to return error when Stack does not exist #6302

mssokal opened this issue Jul 29, 2021 · 2 comments
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. cloudformation duplicate This issue is a duplicate. guidance Question that needs advice or information.

Comments

@mssokal
Copy link

mssokal commented Jul 29, 2021

Is your feature request related to a problem? Please describe.
At the moment when running aws cloudformation delete-stack --stack-name xxxx returns no screen output and only returns exit code = 0 if the stack does not exist

Describe the solution you'd like
The CLI should return error and return code different than 0 if stack does not exist

Describe alternatives you've considered
At the moment I need to confirm the existence of the stack with describe-stacks before sending the delete-stack

Additional context

@mssokal mssokal added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jul 29, 2021
@kdaily kdaily removed the needs-triage This issue or PR still needs to be triaged. label Jul 29, 2021
@kdaily kdaily self-assigned this Jul 29, 2021
@kdaily kdaily added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Jul 29, 2021
@kdaily
Copy link
Member

kdaily commented Jul 29, 2021

Hi @mssokal,

Unfortunately there isn't anything that we can do here. The CloudFormation service is returning a 200 HTTP response indicating that the request was successful. We don't modify the output from the request after that, and since it was successful the CLI returns an exit code of 0 as well. This was previously requested with no change being made from CloudFormation, as it would likely be a breaking change for many other customers who expect this to be a no-op.

#3569

Here's an example you can see in the debug logs of the response:

2021-07-29 15:15:35,930 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): cloudformation.us-west-2.amazonaws.com:443
2021-07-29 15:15:36,068 - MainThread - urllib3.connectionpool - DEBUG - https://cloudformation.us-west-2.amazonaws.com:443 "POST / HTTP/1.1" 200 212
2021-07-29 15:15:36,069 - MainThread - botocore.parsers - DEBUG - Response headers: {'x-amzn-RequestId': '49334796-f9c7-4640-bbcc-4160b0cbd3e6', 'Content-Type': 'text/xml', 'Content-Length': '212', 'Date': 'Thu, 29 Jul 2021 22:15:35 GMT'}
2021-07-29 15:15:36,069 - MainThread - botocore.parsers - DEBUG - Response body:
b'<DeleteStackResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">\n  <ResponseMetadata>\n    <RequestId>49334796-f9c7-4640-bbcc-4160b0cbd3e6</RequestId>\n  </ResponseMetadata>\n</DeleteStackResponse>\n'
2021-07-29 15:15:36,070 - MainThread - botocore.hooks - DEBUG - Event needs-retry.cloudformation.DeleteStack: calling handler <botocore.retryhandler.RetryHandler object at 0x10dfc1c10>
2021-07-29 15:15:36,070 - MainThread - botocore.retryhandler - DEBUG - No retry needed.
2021-07-29 15:15:36,070 - MainThread - awscli.formatter - DEBUG - RequestId: 49334796-f9c7-4640-bbcc-4160b0cbd3e6

The documentation indicates you should use describe-stacks to get the status, including if it has been deleted.

https://docs.aws.amazon.com/cli/latest/reference/cloudformation/describe-stacks.html

@kdaily kdaily added closing-soon This issue will automatically close in 4 days unless further comments are made. guidance Question that needs advice or information. and removed feature-request A feature should be added or improved. investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Jul 29, 2021
@kdaily kdaily removed their assignment Jul 29, 2021
@kdaily kdaily added duplicate This issue is a duplicate. cloudformation labels Jul 29, 2021
@kdaily kdaily closed this as completed Aug 2, 2021
@github-actions
Copy link

github-actions bot commented Aug 2, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. cloudformation duplicate This issue is a duplicate. guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

2 participants