Use Case
ECR repositories currently do not get delete if they contain images even the removalPolicy is set to DESTROY.
It was reported in #2765, and was thought to be a responsibility of CloudFormation team aws-cloudformation/cloudformation-coverage-roadmap#515.
Proposed Solution
I do think we should add a option to force delete the images using custom resource provider, which is just like #12090 that uses a custom resource provider to delete objects in s3.
The code might looks like this:
const bucket = new ecr.Repository(this, 'Repo', {
repositoryName: 'delete-even-if-contains-images',
removalPolicy: cdk.RemovalPolicy.DESTROY,
autoDeleteImages: true,
});
The props autoDeleteImages can only to be true if removalPolicy is set to DESTROY.
Other
This is a 🚀 Feature Request
Use Case
ECR repositories currently do not get delete if they contain images even the
removalPolicyis set toDESTROY.It was reported in #2765, and was thought to be a responsibility of CloudFormation team aws-cloudformation/cloudformation-coverage-roadmap#515.
Proposed Solution
I do think we should add a option to force delete the images using custom resource provider, which is just like #12090 that uses a custom resource provider to delete objects in s3.
The code might looks like this:
The props
autoDeleteImagescan only to be true ifremovalPolicyis set toDESTROY.Other
This is a 🚀 Feature Request