Closed J0F3 closed 2 months ago
Hey @J0F3, let me see if I can clear things up for you. When you remove a resource from a template and re-deploy the deployment stack with said updated template, you are unmanaging the resource. This means that the resource is no longer tethered to the stack. When you specify 'deleteAll', 'detachAll', or 'deleteResources', you are instructing the stack to take that action on all resources that will become unmanaged on the current operation. The detached and deleted resource lists are only a reference to that last operation and a resource can't go from managed --> detached --> deleted; it can only go from managed --> detached or deleted.
Happy to answer more questions/clarify things further or help you find a solution for your scenario if you give some more details.
Hey @dantedallag
The detached and deleted resource lists are only a reference to that last operation and a resource can't go from managed --> detached --> deleted; it can only go from managed --> detached or deleted.
Ah yes, makes perfectly sense. That is what I had misunderstood. I thought the detached resources are tracked by the Deployment Stack until they get actually deleted. But it make sense that they are get in an unmanaged state and therefore are not tethered to the stack anymore.
I was just thinking about some blue/green deployment scenarios where you would create new resources in parallel and let the old ones in detached state. Once the new resources are ready and tested the old, detached resources can be deleted by specify the 'deleteResources' in the next Stack Update. But the longer I think about it I think this should probably better be solved with two Deployment Stacks.
Thank you, you helped me a lot!
Describe the bug I am not sure if I just not completely understand deployment stacks yet or if it is really something that does not work as it should in my tenant or something.
When some resources as removed form the the bicep file and then then Deployment Stack is updated with 'detatchAll' the removed resources are shown as detached resources as expected. But then after the the Deployment Stack is updated again with exactly the same template the detached resources are not shown anymore.
To Reproduce Steps to reproduce the behavior:
resource storageaccount1 'Microsoft.Storage/storageAccounts@2021-02-01' = { name: 'strdeploystacktest123' location: location kind: 'StorageV2' sku: { name: 'Standard_LRS' } }
resource storageaccount2 'Microsoft.Storage/storageAccounts@2021-02-01' = { name: 'strdeploystacktest12345' location: location kind: 'StorageV2' sku: { name: 'Standard_LRS' } }