Hi all, my Pulumi state is stuck such that every t...
# pulumi-cloud
m
Hi all, my Pulumi state is stuck such that every time I run
pulumi up
, it updates a resource that I have not made any changes to (it's a Docker Image resource). When I delete it from my Pulumi file so I can remove it and then build it again, when I run
pulumi up
, I get the error:
error: resource '{my resource urn}' registered twice (same and same)
. I double checked
pulumi stack --show-urns
, and confirmed that the resource is unique. Does anyone have any tips to fix my state? Thanks!
l
To fix the registered twice thing: you need to delete the resource from state as well as code. Do you run
pulumi up
after you remove it from the code? Alternatively, you can skip the remove-from-code step, and just remove it from state via
pulumi state delete
.
For the detects-changes-and-rebuilds-image problem, that can be more complicated. There may be a timestamp change, a base image, or it's simply decided that the moons of Saturn are correctly aligned. Are you using the docker-build provider or the docker provider? docker-build will build less often than the older docker provider. In my experience, it's almost never (and honestly, I'm not sure that "almost" is correct) the right thing to build your image in your Pulumi "deployment" project. It should almost* always be done in a prior "packaging" project, or even outside Pulumi altogether.
m
Do you run
pulumi up
after you remove it from the code?
It did not work the last time I tried, but for some reason it worked just now
Thanks!
h
how are you building the docker image?
m
Copy code
const {myImage} = new docker.Image({...})
l
Try switching to the docker-build provider.
What's the
{myImage}
syntax? Isn't that destructuring? The Image class has no myImage member... 😕