is there any tutorial to split/convert stack to mi...
# general
m
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
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
very bad idea to import thousand of states 🥹
s
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.