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

Destroy non-empty bucket #1977

Closed
saulshanabrook opened this issue May 15, 2015 · 8 comments
Closed

Destroy non-empty bucket #1977

saulshanabrook opened this issue May 15, 2015 · 8 comments

Comments

@saulshanabrook
Copy link

Right now if you try to destroy an S3 bucket with any items in it, terraform will fail:

Error applying plan:

1 error(s) occurred:

* 1 error(s) occurred:

* BucketNotEmpty: The bucket you tried to delete is not empty

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

This is because S3 requires you delete all items before deleting the bucket. It would be great if terraform could do that automatically.

@radeksimko
Copy link
Member

If we treat S3 like RDS which may have some data that we may not want to loose, then there would have to be either an option to do a backup or at least some kind of "force" option making sure that user is absolutely sure about removing data.

If we support removing data in buckets, then this behaviour IMO shouldn't be default (i.e. by default Terraform should still show error from AWS API saying that bucket is not empty).

@mitchellh
Copy link
Contributor

I think a force option makes sense, we do this with launch configurations or ASGs, I always mix up each.

@jimconner
Copy link

+1 for the force option - that would be very handy for our use case too.

@catsby
Copy link
Contributor

catsby commented May 15, 2015

I'm not seeing a force option of any kind in the API. We'd need to get a list and send the keys in a multi object delete API call.

@mitchellh
Copy link
Contributor

@catsby Sorry thats what I meant. Its a TF setting only that we use to just iterate the bucket and do a multi-delete. Yep. Or, that's what we should do.

@m-s-austin
Copy link
Contributor

#2007

@catsby
Copy link
Contributor

catsby commented May 21, 2015

I just merged #2007 which adds a force_destroy option, thanks!

@ghost
Copy link

ghost commented May 2, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators May 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants