Hi, Can someone tell me why `pulumi destroy` fails...
# general
w
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
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
@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
This would happen if anything that isn't Pulumi is putting resources into the repo. For example, is anyone doing a
docker push
?
w
@little-cartoon-10569 no. I'm the sole user within the namespace. No one else can push into the repo.
274 Views