https://pulumi.com logo
#aws
Title
# aws
b

breezy-apartment-46543

03/05/2021, 12:58 PM
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

adorable-musician-67025

03/05/2021, 1:09 PM
I would write a simple loop which removes all objects from the bucket or use method to empty bucket, if available.
b

brave-planet-10645

03/05/2021, 1:17 PM
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

breezy-apartment-46543

03/05/2021, 2:59 PM
Alright thanks, I’ll look into it. I don’t use versioning so it shouldn’t be a problem