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

billions-scientist-31826

01/09/2020, 10:14 PM
Is there an easy way to move state from one project:stack to another project:stack?
a

astonishing-cartoon-37000

01/09/2020, 10:16 PM
pulumi stack export > state.json
select the stack you want to import to with
pulumi stack select
then
cat state.json | pulumi stack import
this works if it is a totally empty stack
b

billions-scientist-31826

01/09/2020, 10:21 PM
you can just move parts of it? I have one big project, but I want to break out the create of AWS IAM resources into it's own project, but leave the other stuff where it is.
a

astonishing-cartoon-37000

01/09/2020, 10:25 PM
ah I feel ya. hmm I don't know any super elegant ways. you can edit the
state.json
file to include what you want, but it's quite tedious. i'm actually currently dealing with a similar challenge 😄
https://www.pulumi.com/docs/reference/cli/pulumi_state_delete/ this works for deleting by ARN, but I can't find anything equivalent for importing
lmk if you figure something better out! would be helpful
b

billions-scientist-31826

01/09/2020, 10:31 PM
ok, that works
I know you can add something like
{ id: <arn> }
in the same block that . you would declare the parent and that brings it in. I guess with that and the state delete solves that.
I saw it in a video. trying to find it.
that is a pain, but works. I was hoping for something like tf mv
a

astonishing-cartoon-37000

01/09/2020, 10:48 PM
yeah I've been wanting that for a while too! I'm sure it's on devs radar
8 Views