Hey all - I love breaking things in new and exciti...
# general
f
Hey all - I love breaking things in new and exciting ways, and we've really done it this time. We had a stack that we didn't update for years - I won't get into why - but we decided to start from scratch. We deleted the statefile in the backend (azure blob), and spun up a brand new stack with the same name, and have been slowly importing resources - but there are "ghosts" of the old stack still remaining 👻 Specifically, when trying to import a certain resource, we see `previously-imported resources that still specify an ID may not be replaced; please remove the
import
declaration from your program` . If this resource was not under pulumi management, we would expect an import operation here. If this resource was managed, we would expect to see a delete operation in our previous runs, since our program hasn't specified it yet. I don't understand why pulumi thinks it was previously-imported (Is it pulling a backup of the statefile? Is it pulling from the checkpoint/history files?), and I also don't understand why the resource would need replacing.
l
Could it be a different resource that it is complaining about? If you have already imported some resources via the
import
opt, have you remembered to remove that opt in subsequent runs of
pulumi up
?
f
We imported the resource group; and that's fine; it's when we try to import the subnet that it says it's already imported
But the subnet isn't in the state file - which makes me think maybe the error message isn't quite right, and we're importing it wrongly enough that it would require a replacement (maybe we're being too aggressive with replace-on-changes, or perhaps we got the subnet address space wrong)
New news though - the only impacted client isn't renewing their contract 😅 so we're probably just going to let them ride it out on the infra they have; if we come up with anything new that's super exciting we can deploy it to them manually
l
Does the code for the resource group have an
import
opt still?
f
For the resource group, yes
l
Once the resource group is imported and in your state file remove the
import
opt
. It's trying to re-import it.
The error message cannot be about the subnet, since that's not a previously-imported resource. Only the resource group is previously-imported, so the error message must be about that resource.
e
I think something's causing the engine to think the resource group needs replacing, must be some change in inputs. It's warning you that the replace will change the ID which means the import option will then be pointing to the old ID which on the next update would then try to re-import the old, now deleted, resource group.