How do you come around the problem that you cannot...
# aws
b
How do you come around the problem that you cannot run pulumi destroy on a project containing an s3 bucket that is non-empty?
a
I would write a simple loop which removes all objects from the bucket or use method to empty bucket, if available.
b
There is a
forceDestroy
property that you can set https://www.pulumi.com/docs/reference/pkg/aws/s3/bucket/#forcedestroy_nodejs When you run destroy it will delete all the objects in the bucket before deleting the bucket. It doesn't work if you've got versioning set on the bucket though.
Or you could do what Sebastian said, but we don't actually run any of your code when you run destroy. We just go through the resources in the state and use that do delete them.
You could do it with the automation api though
b
Alright thanks, I’ll look into it. I don’t use versioning so it shouldn’t be a problem