I recently renamed my org and I'm getting a lot of...
# general
h
I recently renamed my org and I'm getting a lot of errors like this from stack references when trying to refresh. Is there any better way to remediate it than to edit the stack state or bring everything down and back up again?
Copy code
» p refresh
Previewing refresh (dev)

View in Browser (Ctrl+O): <https://app.pulumi.com/myorg/myapp/dev/previews/22c0041d-fd3a-4ada-b7c3-b24131d83706>

     Type                              Name                                Plan        Info
     pulumi:pulumi:Stack               oncall-slackbot-dev                             1 error
     ├─ pulumi:pulumi:StackReference   myorg/myotherapp/dev                                  
     ├─ pulumi:providers:kubernetes    gke_k8s                                         

Diagnostics:
  pulumi:pulumi:StackReference (myorg/myotherapp/prod):
    error: Preview failed: unknown stack "myorg/myotherapp/prod"

  pulumi:pulumi:StackReference (myorg/myotherapp/dev):
    error: Preview failed: unknown stack "myorg/myotherapp/dev"

  pulumi:pulumi:Stack (myapp-dev):
    error: preview failed
b
Does this stack & the one it is referring are in the same org?
h
Yes
b
From the error it seems as if the stacks are still not part of the org, maybe you can try a pulumi up/refresh on the stacks which are being referred here first
h
Unfortunately that didn't work. The only thing that seems to work is deleting the stack ref from the stack state
b
Yes that would work but if this ref is coming from the code then won't it come back again if you run pulumi up/preview?
also for reference we need orgname/stack-name are you doing the same?
What do you see when you do
pulumi stack ls
from the project?
pulumi:pulumi:Stack               oncall-slackbot-dev
here your stack name is showing as
oncall-slackbot-dev
this is
<project-name>-<stack-name>
so your project name is
oncall-slackbot
? and stack is
dev
right?
But
View in Browser (Ctrl+O): <https://app.pulumi.com/myorg/myapp/dev/previews/22c0041d-fd3a-4ada-b7c3-b24131d83706>
this is showing
myapp/dev
I am guessing if the projects
myapp
&
oncall-slackbot
are in the same org?
you need to do
pulumi refresh --yes
first to update the stack reference in the state & then update the code if
pulumi refesh --yes
doesn't work then there are definitely some issues around referencing
h
Sorry yeah I failed to replace all the names but those projects were in the same org. Refreshing failed because the stack with the old org name wasn't found but once I deleted it from the state it worked.
Updating the state per stack seems to be working although it's a bit cumbersome so far