Hi, Can someone tell me why `pulumi destroy` fails...
# general
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',
          ) as pulumi.Output<string>
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
there. All that does is wrap the imageName (which is an Output<string>) in another Output<string>.
@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
But for other stacks
pulumi destroy
removes the repo with the images with out any issue.
This would happen if anything that isn't Pulumi is putting resources into the repo. For example, is anyone doing a
docker push
@little-cartoon-10569 no. I'm the sole user within the namespace. No one else can push into the repo.