https://pulumi.com logo
#general
Title
# general
w

wide-wire-45375

09/19/2022, 10:15 PM
Hi, Can someone tell me why
pulumi destroy
fails to remove ecr repo? It gives an error indicating the repo is not empty. I am trying to delete the repo as well as the images with
pulumi destroy
command. This code that creates the ecr image:
Copy code
const imageUrl = pulumi.output(
            awsx.ecr.buildAndPushImage('my-image', {
                context: './',
                dockerfile: './Dockerfile.track',
            }).imageValue
          ) as pulumi.Output<string>
l

little-cartoon-10569

09/19/2022, 10:42 PM
Things can get created in the repo that aren't managed by Pulumi. Which means, Pulumi can't delete them. AWS has a requirement that the repo must be empty before it can be deleted.
You either need to create all items in the repo through Pulumi (so that
pulumi destroy
knows to delete them), or else you need remove them from the repo before running
pulumi destroy
.
Aside: you don't need
pulumi.output()
there. All that does is wrap the imageName (which is an Output<string>) in another Output<string>.
w

wide-wire-45375

09/19/2022, 11:08 PM
@little-cartoon-10569 thanks for your reply. The thing is, my image and the ecr repo both were created through pulumi. In other stacks with similar structure, the
pulumi destroy
works perfectly. But, in some cases it doesn't work.
currently, I have to delete the image (which was created through pulumi) from aws dashboard, then use the
pulumi destroy
command.
But for other stacks
pulumi destroy
removes the repo with the images with out any issue.
l

little-cartoon-10569

09/19/2022, 11:48 PM
This would happen if anything that isn't Pulumi is putting resources into the repo. For example, is anyone doing a
docker push
?
w

wide-wire-45375

09/20/2022, 5:09 AM
@little-cartoon-10569 no. I'm the sole user within the namespace. No one else can push into the repo.
226 Views