any recommendations on splitting an existing stack...
# general
any recommendations on splitting an existing stack into two separate ones ?
The way I've done it before is: 1. Create the new stack 2. Export the first stack and import it into the second stack 3. For each stack, get a list of URNs that you want to delete 4. Run
pulumi state delete <URN>
for each URN in each stack 5. Done Your mileage may vary, but I find this to be the easiest. Building a new stack from scratch and importing resources is just way too time consuming. The old stack already has all the information
To get the URNs,
or a carefully crafted
do the job.
Or even just output to a file and edit by hand, doesn't really matter as long as you feel comfortable with it.
Great, thank you
Save a copy of the old stack just in case 🙂
The interesting bit is that you don't need to touch any resource during this operation. After you split the stacks and do
pulumi up
on both of them, nothing should change. If that's the case, success! If you think you screwed up, load the backup and try again.