https://pulumi.com logo
#general
Title
# general
d

dazzling-scientist-80826

09/21/2018, 9:32 PM
how can i move a stack from one org to another?
b

bitter-oil-46081

09/21/2018, 9:33 PM
It's a little hacky today, but you should be able to do the following: 1. Export the stack with
pulumi stack export
2. Create a new stack with the same name in the target organization
pulumi stack init <org-name>/<stack-name>
3. Import the stack you exported with
pulumi stack import
4. Since secret configuration is encrypted with a key tied to the stack itself, you'll have to (unfortunately) run
pulumi config set --secret <key> <value>
to reset any encrypted configuration you have. 5. You should now be able to
pulumi stack rm
the old stack. You don't want to run
pulumi destroy
.
d

dazzling-scientist-80826

09/21/2018, 9:42 PM
ok - will give it a shot
oh - what if i want to rename it too? is that a separate step?
b

bitter-oil-46081

09/21/2018, 9:53 PM
This will be a little trickier. Since the URN of every resource includes both the stack name (sans organization) and project it is in, you'll have to manually export the stack and then edit the checkpoint to rename the stack name in the URN. and then import the new checkpoint, So between 2 and 3, edit the checkpoint you exported and replace
urn:pulumi:<old-stack-name>::
with
urn:pulumi:<new-stack-name>::
. @microscopic-florist-22719 Does that sound right to you?
m

microscopic-florist-22719

09/21/2018, 9:57 PM
I think so, yes. Note that the
import
will refuse to proceed if the stack name is incorrect, so at the very least we have belt and suspenders here.
d

dazzling-scientist-80826

09/21/2018, 9:58 PM
this UX is pretty bad - creating the new stacks overwrote my config files
luckily i was able to
git checkout
to get them back
or maybe i was just confused? i’m not sure what happened
got it sorted - will do the rename soon
thanks
oh yeah, removing the stack deletes the config file
reaaaally should not do that
especially if the file is dirty
maybe suggest it in the output?
ugh, now i need to go recover the secrets from elsewhere
i luckily ran config --show-secrets not too long ago
but how do i backup my secret key for later?
b

bitter-oil-46081

09/21/2018, 10:14 PM
but how do i backup my secret key for later?
There's no concept of that today. The kye is created when a stack is initialized and managed by the service for the lifetime of the stack.
d

dazzling-scientist-80826

09/21/2018, 10:19 PM
sigh this did not go well
i have two stacks and somehow didn’t properly stack export one of them
i removed the old stack before importing it
is there any way to recover it?
m

microscopic-florist-22719

09/21/2018, 10:20 PM
we can help you out here, yes.
d

dazzling-scientist-80826

09/21/2018, 10:20 PM
thank you!
whew.
m

microscopic-florist-22719

09/21/2018, 10:21 PM
can you DM me the name of the deleted stack?
d

dazzling-scientist-80826

09/21/2018, 10:21 PM
yes, thanks
16 Views