This message was deleted.
# typescript
s
This message was deleted.
l
Unless the new properties of
Resource A
depend directly on the outputs of
Resource B
, you should be able to approach it like
Copy code
if(bEnabled){
   new ResourceA(argsAB)
   new ResourceB(argsB)
} else {
   new ResourceA(argsA)
}
l
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
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
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 🙂).