pulumi-aws-native icon indicating copy to clipboard operation
pulumi-aws-native copied to clipboard

aws.ecr.Repository with emptyOnDelete=true does not empty the repository on delete

Open rgl opened this issue 2 years ago • 4 comments

What happened?

While trying to delete a ECR repository that still has content/images it failed with:

error: operation DELETE failed with "GeneralServiceException": The repository with name 'pulumi-typescript-aws-native-ecr-example/example-4b5b730' in registry with id '0000' cannot be deleted because it still contains images (Service: Ecr, Status Code: 400, Request ID: 00000000-0000-0000-0000-000000000000)

PS this works fine with the classic provider (e.g. at https://github.com/rgl/pulumi-typescript-aws-classic-ecr-example).

Example

        const repository = new aws.ecr.Repository(`${project}/${name}`, {
            emptyOnDelete: true,
            imageTagMutability: "IMMUTABLE",
            imageScanningConfiguration: {
                scanOnPush: false,
            },
            tags: getMergedDefaultTagsArg(tags),
        });

PS The full example is at https://github.com/rgl/pulumi-typescript-aws-native-ecr-example.

Output of pulumi about

CLI          
Version      3.101.1
Go Version   go1.21.5
Go Compiler  gc

Plugins
NAME        VERSION
aws-native  0.93.0
command     0.9.2
nodejs      unknown

Host     
OS       ubuntu
Version  22.04
Arch     x86_64

This project is written in nodejs: executable='/usr/bin/node' version='v20.11.0'

Current Stack: organization/pulumi-typescript-aws-native-ecr-example/dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend        
Name           dm1.lan
URL            file:///home/vagrant/Projects/pulumi-typescript-aws-native-ecr-example
User           vagrant
Organizations  
Token type     personal

Dependencies:
NAME                VERSION
@pulumi/pulumi      3.101.1
@types/node         20.11.0
@pulumi/aws-native  0.93.0
@pulumi/command     0.9.2

Pulumi locates its logs in /tmp by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

rgl avatar Jan 14 '24 09:01 rgl

I have the same problem ! Do you have any update regarding this issue ?

jbdelhommeau avatar Apr 30 '24 08:04 jbdelhommeau

I'm afraid this is still happening with the latest pulumi, which I'm now using at https://github.com/rgl/pulumi-typescript-aws-native-ecr-example/commit/fd3064d6c8e706bb30d89973ba8d1bbd89f52a75:

CLI          
Version      3.116.1
Go Version   go1.22.2
Go Compiler  gc

Plugins
KIND      NAME        VERSION
resource  aws-native  0.105.0
resource  command     0.11.0
language  nodejs      unknown

Host     
OS       ubuntu
Version  22.04
Arch     x86_64

This project is written in nodejs: executable='/usr/bin/node' version='v20.13.1'

Current Stack: organization/pulumi-typescript-aws-native-ecr-example/dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend        
Name           dm1.lan
URL            file:///home/vagrant/Projects/pulumi-typescript-aws-native-ecr-example
User           vagrant
Organizations  
Token type     personal

Dependencies:
NAME                VERSION
@pulumi/aws-native  0.105.0
@pulumi/command     0.11.0
@pulumi/pulumi      3.116.1
@types/node         20.12.12

Pulumi locates its logs in /tmp by default

rgl avatar May 17 '24 19:05 rgl

I just created an issue with CloudFormation on this. Lets see what they say.

corymhall avatar May 17 '24 19:05 corymhall