https://pulumi.com logo
Title
b

better-shampoo-48884

03/30/2021, 12:42 PM
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

brave-planet-10645

03/30/2021, 12:44 PM
We have some steps here but it looks like you've followed them. Did you export with the secrets?
b

better-shampoo-48884

03/30/2021, 12:45 PM
I can try the secrets bit
Nope 馃槙
位 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

brave-planet-10645

03/30/2021, 12:54 PM
What version of the pulumi CLI are you running (
pulumi version
)?
b

better-shampoo-48884

03/30/2021, 12:54 PM
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

brave-planet-10645

03/30/2021, 1:01 PM
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

better-shampoo-48884

03/30/2021, 1:03 PM
....
that's.. the thing. I knew it was something fundamentally stupid and trivial!
thanks!
b

brave-planet-10645

03/30/2021, 1:07 PM
they are very similar but I'm glad it worked 馃憤
b

better-shampoo-48884

03/30/2021, 1:10 PM
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:
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:
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

cool-fireman-90027

03/30/2021, 2:21 PM
You could also use aliases
b

better-shampoo-48884

03/30/2021, 2:23 PM
ah cool - never knew about that actually 馃檪 that'll come in handy, thanks!