[Hubs] Switch to a deployment stack
â ī¸ Problem
Resources are being left behind as we move from one version to the next when using Azure deployment templates.
đ ī¸ Solution
Switch to deployment stacks, which can clean up removed resources.
âšī¸ Additional context
See https://learn.microsoft.com/azure/azure-resource-manager/bicep/deployment-stacks?tabs=azure-powershell
đââī¸ Ask for the community
We could use your help:
- Please vote this issue up (đ) to prioritize it.
- Leave comments to help us solidify the vision.
Deployment stacks require a JSON template, so here's how I tested this...
cd src/scripts./Build-Toolkit finops-hubcd ../../release/finops-hubbicep build main.bicepmv main.bicep ../../src/templates/finops-hub/test- In VS Code, edit the
finops-hub/test/main.bicepfile to be:targetScope = 'resourceGroup' param uniqueName string = 'ftk-hub-localtest1' param location string = 'westus2' resource stack 'Microsoft.Resources/deploymentStacks@2022-08-01-preview' = { name: 'stack-test' properties: { deploymentScope: resourceGroup().id description: 'FinOps hub' template: loadJsonContent('./main.json') parameters: { hubName: uniqueName location: location } actionOnUnmanage: { resources: 'delete' } denySettings: { mode: 'denyWriteAndDelete' } } } output hubName string = stack.id cd ../../src/scripts./Deploy-Toolkit finops-hub -Test
Deployment is spinning forever, but if you look at the operation details in the deployment, you can see this error: Resource Provider has encountered an internal server error. Diagnostic information: timestamp '2023-10-05 09:16:09Z', request ID '5646a3c6-a259-43f0-8932-e4caf9b465e1', request correlation ID '02ef0d4d-6b56-4721-b9fc-3fe8c8465719'.
We'll need to try again in a future release. Seems it's not ready yet.