https://pulumi.com logo
#dotnet
Title
# dotnet
b

boundless-tailor-35598

03/12/2024, 5:56 PM
Back in the day, I started creating pulumi c# stacks and doing this with 1 c# project per stack. This has now grown unmanageable as Rider doesn't cope too well with over 400 projects! So I need to consolidate to a small number of c# projects and have the code for multiple stacks within these projects. One would think this was as simple as migrating the Stack code to the new project as well as the yaml files and then calling pulumi up --stack [stack name]. However, this appears to want to delete the original resources in the stack. Is there any way to refactor and move stacks from one c# project to another without having to destroy the resources and recreate?
b

bored-activity-40468

03/13/2024, 5:08 AM
Interesting, what does it say is changing that requires it to recreate? If the project/stack names are the same. You might check out using alias to help possibly, https://www.pulumi.com/blog/cumundi-guest-post/
b

boundless-tailor-35598

03/13/2024, 6:29 PM
Hi @bored-activity-40468 project/stack names are the same. I will take a look at alias to see if that helps - thanks for the link!
I wonder how people using Pulumi have achieved refactoring of stacks across c# projects. It doesn't look possible as I see it without destroying and recreating resources which is a bit of a disaster for long-lived resources with 3rd party dependencies (e.g vpcs and networks with vpc peering and direct connects with 3rd parties etc)
or manually importing into a new stack perhaps? Would love to hear from those who have managed it successfully.
b

bored-activity-40468

03/13/2024, 9:39 PM
I've been following the https://github.com/gitfool/Pulumi.Dungeon pattern but with some differences. The main one is not having libraries per provider but per org so all the stacks have been in a single lib up to this point.