Is there a good way to refactor into multiple stac...
# general
f
Is there a good way to refactor into multiple stacks/projects? How to move current state over if e.g. refactoring a module into a separate project/stack?
f
I haven’t tried this before but would be interesting to know if it works: 1. Create new project / stack for broken out resources and move code from old project over into the new project. 2. Run
pulumi stack export
on the old stack and remove the right resources and place them in a separate file. Take the new file and use
pulumi stack import
. When running
pulumi preview
there shouldn’t be any changes. 3. Run
pulumi stack export
in the new project / stack. Update the file to include the resources you removed from the former project and import it using
pulumi stack import
. Again you should see that there are no changes required for the project.
a
One thing to be aware of is the
--secrets-provider
if you have any secrets in the monolith stack.
f
Good call ☝️
We actually did some work to make this easier recently, see: https://github.com/pulumi/pulumi/pull/4046
If you have secrets, you can use the
--show-secrets
flag
Also we updated the documentation to include some information on these types of flows.. see: https://github.com/pulumi/docs/issues/3309
This functionality is part of the 2.2 release so make sure to update if you plan to use it 🙂
a
Thanks @future-barista-68134!!
f
Thanks for the input 😄 just updated to 2.3 (living on the edge)
Luckily I'm still in early stages, so hoping editing the export is manageable. Rather get this structure right before things grows too much.
hmmm maybe I spoke too soon, export is 20k lines (we have a lot of dns entries) ... will see how tough it is to edit.
😟
maybe needs some jq magic