I'm trying to move a stack between an old local-di...
# general
b
I'm trying to move a stack between an old local-disk project and a new azure-storage backed project - so I exported the stack, moved the resulting json to the new project, and tried to import it from there. It shows no resources. I'm doing something wrong, and I have no idea what (including the thought that moving a stack from one project to another could be possible) 🙂. Ideas?
b
We have some steps here but it looks like you've followed them. Did you export with the secrets?
b
I can try the secrets bit
Nope 😕
Copy code
λ pulumi import -f cad-ingestion.json --suppress-outputs
Previewing import (dev.infra.infratesting):

Resources:

Do you want to perform this import?  [Use arrows to move, enter to select, type to filter]
  yes
> no
  details
ahh.. right, going to try one more thing.
nope. not with login/logout, not with any of the other stuff.
tried moving/renaming the stack as well, it created a new one with a new passphrase - but still no resources.
even tried a global search & replace for the oldProjectName -> newProjectName.
b
What version of the pulumi CLI are you running (
pulumi version
)?
b
err
λ pulumi version 2.23.2
oldProject is in a different path than newProject - but that shouldn't matter right? It's still relative to its Pulumi.yaml
b
oh... I see... it's not
pulumi import
it's
pulumi stack import -f cad-ingestion.json
you're importing the stack, not a resource
my bad
b
....
that's.. the thing. I knew it was something fundamentally stupid and trivial!
thanks!
b
they are very similar but I'm glad it worked 👍
b
yeah - complete mindblorp when using two terminals and typing by hand. just omitting the word "stack" from the import completely slipped my mind.. now on to the harder part of reconciling the damned things.. it wants to delete everything i have and create everything again 😄
Ran a refresh to make sure that the stack resolved its resources correctly, and it did. on preview though, it wants to delete all the things I have and replace them with the exact same things (and the exact same configuration on them as well)
Ok - I've gone through everything it tries to do - and honestly I've narrowed it down to this:
Is there any way of getting pulumi to accept the old URN uid as "good" after a stack import instead of having to recreate everything? this is the only diff i have where it wants to destroy every resource and create new resources which happen to be exactly the same as the ones destroyed:
Copy code
create:      [provider=urn:pulumi:dev.infra.cad-ingestion::baseline-infra::pulumi:providers:azure-native::default_0_7_1::04da6b54-80e4-46f7-96ec-b56ff0331ba9]
destroy:     [provider=urn:pulumi:dev.infra.cad-ingestion::modularity::pulumi:providers:azure-native::default_0_7_1::aa842b3f-7bf5-4401-b0eb-a65d275ed25d]
should I have renamed the project in the exported .json?
Is there any way of getting pulumi to accept the old URN as "good" after a stack import instead of having to recreate everything? this is the only diff i have where it wants to destroy every resource and create new resources which happen to be exactly the same as the ones destroyed:
Copy code
create:      [provider=urn:pulumi:dev.infra.cad-ingestion::baseline-infra::pulumi:providers:azure-native::default_0_7_1::04da6b54-80e4-46f7-96ec-b56ff0331ba9]
destroy:     [provider=urn:pulumi:dev.infra.cad-ingestion::modularity::pulumi:providers:azure-native::default_0_7_1::aa842b3f-7bf5-4401-b0eb-a65d275ed25d]
argh.. why do I always have to figure it out when posting my humiliation to #general 🙂 solution: export stack, rename "modularity" to "baseline-infra" and import stack again. sigh.
c
You could also use aliases
b
ah cool - never knew about that actually 🙂 that'll come in handy, thanks!