Azure / Azure/deployment-stacks
One resource can be managed by multiple stacks
- Dominant language
- Bicep
- Stars
- 101
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Due to an [issue](https://github.com/Azure/deployment-stacks/pull/14) in the tutorial, I created multiple stacks that managed the same set of resources. (in this case the 4 storage accounts)
I would expect this to be impossible, as different stacks can have different behaviors to deal with resource lifecycle.
**To Reproduce**
Steps to reproduce the behavior:
1. follow the tutorial as it [currently](https://github.com/Azure/deployment-stacks/commit/ef0616ea7a5f5393e8a1437c0c17623697c422f8) is.
2. Do not purge the resources.
3. You will have 2 stacks governing the same resources.
```
Get-AzSubscriptionDeploymentStack
Id : /subscriptions/mysub/providers/Microsoft.Resources/deploymentStacks/mySubStack
Name : mySubStack
ProvisioningState : succeeded
UpdateBehavior : purgeResources
Location : westeurope
CreationTime(UTC) : 22-10-2021 06:35:05
ManagedResources : /subscriptions/mysub/resourceGroups/dvstrldtstrg1/providers/Microsoft.Storage/storageAccounts/dvstrldtstzbl4bnkm4vvlgb
/subscriptions/mysub/resourceGroups/dvstrldtstrg2/providers/Microsoft.Storage/storageAccounts/dvstrldtstzbl4bnkm4vvlgc
/subscriptions/mysub/resourceGroups/dvstrldtstrg2/providers/Microsoft.Storage/storageAccounts/dvstrldtstzbl4bnkm4vvlgd
DeploymentId : /subscriptions/mysub/providers/Microsoft.Resources/deployments/mySubStack-2021-10-22-06-59-58-10f8b
SnapshotId : /subscriptions/mysub/providers/Microsoft.Resources/deploymentStacks/mySubStack/snapshots/2021-10-22-06-59-58-10f8b
Id : /subscriptions/mysub/providers/Microsoft.Resources/deploymentStacks/stack
Name : stack
ProvisioningState : succeeded
UpdateBehavior : purgeResources
Location : westeurope
CreationTime(UTC) : 22-10-2021 06:45:26
ManagedResources : /subscriptions/mysub/resourceGroups/dvstrldtstrg1/providers/Microsoft.Storage/storageAccounts/dvstrldtstzbl4bnkm4vvlgb
/subscriptions/mysub/resourceGroups/dvstrldtstrg2/providers/Microsoft.Storage/storageAccounts/dvstrldtstzbl4bnkm4vvlgc
/subscriptions/mysub/resourceGroups/dvstrldtstrg2/providers/Microsoft.Storage/storageAccounts/dvstrldtstzbl4bnkm4vvlgd
DeploymentId : /subscriptions/mysub/providers/Microsoft.Resources/deployments/stack-2021-10-22-06-50-18-88bdf
SnapshotId : /subscriptions/mysub/providers/Microsoft.Resources/deploymentStacks/stack/snapshots/2021-10-22-06-50-18-88bdf
```
**Expected behavior**
I would expect to see an error when creating 2 stacks that govern the same resource.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.