Is there a good way to refactor into multiple stac...
# general
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?
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.
One thing to be aware of is the
if you have any secrets in the monolith stack.
Good call ☝️
We actually did some work to make this easier recently, see:
If you have secrets, you can use the
Also we updated the documentation to include some information on these types of flows.. see:
This functionality is part of the 2.2 release so make sure to update if you plan to use it 🙂
Thanks @future-barista-68134!!
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