Skip to content

aws-s3: deleting stack with already deleted S3 bucket with auto_delete_objects fails #16619

@rittneje

Description

@rittneje

If a stack is created that has an S3 bucket with auto_delete_objects=True (and RetentionPolicy.DESTROY), and then the S3 bucket is deleted outside CloudFormation, then deleting the stack will fail with an error.

Reproduction Steps

  1. Create a stack with an S3 bucket with auto_delete_objects=True.
  2. Manually delete the S3 bucket via the console.
  3. Delete the stack.

What did you expect to happen?

I expected the stack deletion to vacuously succeed. If the bucket in question had been deployed with auto_delete_objects=False, this would have been the observed behavior.

What actually happened?

Deleting the custom resource failed, and thus so did deleting the stack.

Environment

  • CDK CLI Version : 1.118.0
  • Framework Version:
  • Node.js Version: 14.17.5
  • OS : debian bullseye (running inside a container)
  • Language (Version): Python 3.9.6

Other

The custom resource lambda should handle the "not found" exception from S3 and treat it as a vacuous success.


This is 🐛 Bug Report

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-s3Related to Amazon S3bugThis issue is a bug.effort/smallSmall work item – less than a day of effortp1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions