question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Buckets that use versioning can't be deleted

See original GitHub issue

It seems that pulumi cannot automatically delete buckets that have versioned contents. When attempting to pulumi destroy stacks with such buckets, pulumi stays in the deleting... phase forever. If I open up the S3 console and manually delete all content – including all versions – then pulumi destroy completes successfully.

Note that this is NOT an issue with forceDestroy – it is set to true in my stack.

Someone on slack pointed me to this page, which says that buckets cannot be deleted if they have > 100,000 objects or have versioning enabled. It sounds as if the API should return a failure code, though that’s not stated declaratively and I haven’t tried the manual operation through e.g. the aws cli.

I realize it would likely be tricky to have pulumi delete all the bucket content for you, but perhaps an error could be thrown (if indeed the operation does result in a failure code) or a warning that the program may hang could be printed (if the actual API call itself hangs).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
nebblescommented, Nov 19, 2022

Forgive me as I’m still wrapping my head around the difference between the Pulumi AWS V1 and V2…

I’m running @pulumi/aws version 5.14.0 (not the latest, but should have this change). I’m using the V2 approach to buckets and object lifecycle configuration. Should the change by the terraform provider fix the behaviour of the V2 buckets?

I have observed in August/September that I was having the issue the OP described - since Pulumi could not destroy the bucket for me I first tried to go in manually to delete the objects and versions, but in the end had to use a particular AWS CLI command to delete them all for me, before the Pulumi command to destroy the bucket actually worked. My preference of course would be that Pulumi is able to control this for me.

1reaction
lukehobancommented, Nov 19, 2022

Yes - that fix would have been available as of https://github.com/pulumi/pulumi-aws/releases/tag/v5.2.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deleting object versions from a versioning-enabled bucket
When versioning is enabled, a simple DELETE cannot permanently delete an object. Instead, Amazon S3 inserts a delete marker in the bucket, and...
Read more >
Options to delete millions of objects from a versioning-enabled ...
This article discusses three options to delete the versioning-enabled S3 bucket objects. Option 1 is for a simple bucket, which has objects in...
Read more >
How do I delete a versioned bucket in AWS S3 using the CLI?
Just select your bucket and click on it. It will ask you to confirm your decision by typing permanently delete Note, this will...
Read more >
Why Can't I Delete a Bucket? - 华为云
A bucket cannot be deleted.Possible causes are described here in order of how likely they are to occur. To locate the root cause...
Read more >
Using Object Versioning - Oracle Help Center
Retention Rules · You cannot add retention rules to a bucket that has versioning enabled. · You cannot enable versioning on a bucket...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found