Deploying after changing the ECR Repository
property from autoDeleteImages
to emptyOnDelete
results in error:
AccessDeniedException ... because no identity-based policy allows the ecr:DescribeRepositories action
this.ecr = new Repository(this, 'Ecr', {
repositoryName: "test-ecs-api-svc",
removalPolicy: RemovalPolicy.DESTROY,
// otherwise won't be able to destroy on removal
// autoDeleteImages: true,
emptyOnDelete: true,
});
How to get rid of the deprecated property?
The trick is to do it in two deploy
steps:
autoDeleteImages
propertycdk deploy
emptyOnDelete
propertycdk deploy
againAnnoying, but it seems to get it done.