Azure / Azure/arm-template-whatif
Existing resource group is not reported as not existing, if in fact it does not exist.
- Dominant language
- HTML
- Stars
- 102
- Forks
- 21
- Avg merge
- 3h 35m
- Merged PRs (30d)
- 1
Description
## Describe the noise
**Resource type** (i.e. Microsoft.Storage/storageAccounts)
Microsoft.Resources/resourceGroups
**apiVersion** (i.e. 2019-04-01)
2022-09-01
**Client (PowerShell, Azure CLI, or API)**
Azure CLI
**Relevant ARM Template code (we only need the resource object for the above `resourceType` and `apiVersion`, but if it's easier you can include the entire template**
targetScope = 'subscription'
var resourceGroupName = 'rg-${appName}-${environment}'
resource resourceGroup 'Microsoft.Resources/resourceGroups@2022-09-01' existing = {
name: resourceGroupName
}
**Expected response (i.e. "I expected no noise since the template has not been modified since the resources were deployed)**
If the resource group does not exist, I expect it to tell me that. Instead, it says "no changes", and of course I get a 404 if I run it.
**Current (noisy) response (either include a screenshot of the what-if output, or copy/paste the text)**
{"status":"Failed","error":{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"NotFound","message":"{\r\n \"error\": {\r\n \"code\": \"ResourceGroupNotFound\",\r\n \"message\": \"Resource group 'rg-test-dev' could not be found.\"\r\n }\r\n}"},{"code":"NotFound","message":"{\r\n \"error\": {\r\n \"code\": \"ResourceGroupNotFound\",\r\n \"message\": \"Resource group 'rg-test-dev' could not be found.\"\r\n }\r\n}"},{"code":"NotFound","message":"{\r\n \"error\": {\r\n \"code\": \"ResourceGroupNotFound\",\r\n \"message\": \"Resource group 'rg-test-dev' could not be found.\"\r\n }\r\n}"},{"code":"NotFound","message":"{\r\n \"error\": {\r\n \"code\": \"ResourceGroupNotFound\",\r\n \"message\": \"Resource group 'rg-test-dev' could not be found.\"\r\n }\r\n}"}]}}
**Additional context**
Add any other context about the problem here.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the Azure CLI what-if operation with the subscription-scoped Bicep template and the existing Microsoft.Resources/resourceGroups@2022-09-01 resource shown in the issue. Compare the reported “no changes” result with the subsequent 404, then trace the what-if handling for missing existing resource groups. Done means the missing resource group is reported during what-if rather than being treated as unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100