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

modern-art-40204

07/18/2023, 4:23 AM
is there any tutorial to split/convert stack to microstack? https://www.pulumi.com/docs/using-pulumi/organizing-projects-stacks/ don't show how to do it
As I known, we must backup and restore state into multiple microstacks Then delete unused ones?
s

salmon-account-74572

07/18/2023, 4:51 PM
1. Use
pulumi import
to import resources into a new stack (and generate corresponding code). 2. Use
pulumi state delete
to remove resources from state in the old stack. Update code to no longer create those resources. 3. Verify that
pulumi up
behaves as expected for each stack (old and new), adjust code as needed.
m

modern-art-40204

07/19/2023, 5:09 AM
very bad idea to import thousand of states 🥹
s

salmon-account-74572

07/19/2023, 3:25 PM
It is possible to use
pulumi stack export
to get the state (in JSON), modify that, import it back in to a new stack with
pulumi stack import
, and then follow steps 2 and 3 from above. However, we don’t generally recommend this process.