Can I "merge" two stacks? For example, initially w...
# general
r
Can I "merge" two stacks? For example, initially we created a
management
project, which created permission set and account assignments. Then in another repo, a new
iam
project was created for a different set of permission set plus account assignments. Both applied on the same AWS account. Now we want to merge both and put them under the
iam
project. How to do that?
s
You’d need to import the
management
project resources into the
iam
project. That will add them to the state for the
iam
project (stack, to be more specific) and generate code for you to add to your program. From there, you may need to adjust the code so that
pulumi up
doesn’t make any changes or replacements. Once that’s done, remove the items from
management
project’s state (using
pulumi state delete
, as outlined in your other thread) and then delete the stack once its state is empty. (Don’t run
pulumi destroy
on the original stack unless you’ve removed all the resources from state first!)
r
Got it - thanks Scott! Is merging two stack without going though the cloud resources something on the roadmap?
s
We are actively working on improving the experience of moving resources between stacks, but I don’t have any firm timelines on when that might happen. (For example, some improvements to
pulumi stack import
were recently shipped to make that functionality more robust.)