Azure / deployment-stacks

Contains Deployment Stacks CLI scripts and releases
MIT License
87 stars 7 forks source link

Question: adding an existing resource to a stack #50

Closed henrybeen closed 2 years ago

henrybeen commented 2 years ago

I guess the title says it all: can I add an existing resource to a deployment stack?

snarkywolverine commented 2 years ago

You can add a resource to a stack by adding it to the underlying template, and then redeploy the stack.

There is no other mechanism for this. Is there a scenario for you where that's an issue?

henrybeen commented 2 years ago

I can see how this works, when you do it once.

What would happen if I try to add the same resource to two stacks this way? Will it be concidered for purge when either stack is udpated? Or will it be detached from the first stack when I add it to the second one?

TSunny007 commented 2 years ago

Currently, nothing restricts a resource being managed by multiple stacks, and in this case, one stack update with UpdateBehavior = PurgeResources would delete the underlying resource even if another stack is managing it. This is primarily because we don't want to restrict the user from their use cases, and if managing the same resource in two different stacks is the user's design pattern, we adhere to it.