if(bEnabled){
new ResourceA(argsAB)
new ResourceB(argsB)
} else {
new ResourceA(argsA)
}
l
little-cartoon-10569
09/09/2021, 8:05 PM
If you need to update resource A after both resource A and resource B are created, then you need a different project / stack. automation-api helps with this. There is no ability within any declarative system to change the declaration after making it. Pulumi is a declarative system.
✅ 2
p
proud-pizza-80589
09/12/2021, 7:27 AM
Well, you can also see different “runs” of pulumi up as the modify. Run 1, just A, run 2 A+B with all the settings changed (it is ts, you can do anything you want) and pulumi will reconfigure A based on the new settings.
l
little-cartoon-10569
09/12/2021, 9:11 PM
Yep, changing the declaration of an existing resource works. I do this when setting up peering between VPCs that are declared in different stacks. It's not the easiest-to-read code since you need to know that the flow changes in stack A based on whether or not stack B has been deployed. But I think it's working (hard to tell without completely destroying everything and deploying from scratch.. which I'm not keen on trying 🙂).
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.