Azure / bicep-types-az

Bicep type definitions for ARM resources
MIT License
86 stars 27 forks source link

Microsoft.Resources/deployments@2021-04-01 The 'location' property must be specified #2269

Open slavizh opened 2 years ago

slavizh commented 2 years ago

Bicep version Bicep CLI version 0.4.1124 (66c84c8ee5)

Describe the bug When you define resource Microsoft.Resources/deployments for subscription/management group scope you should get an error that location property is not specified. I did not get such error/warning in VSC/bicep.

To Reproduce Steps to reproduce the behavior:

targetScope = 'subscription'

@batchSize(1)
resource dummyDeployments 'Microsoft.Resources/deployments@2021-04-01' = [for (dummyDeployment, index) in range(0, 5): {
  dependsOn: [
    policyDefinitions
  ]
  name: 'dummyTemplatePolicy-${uniqueString(categoryName)}-${index}'
  properties: {
    mode: 'Incremental'
    template: {
      '$schema': 'https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#'
      contentVersion: '1.0.0.0'
      resources: []
    }
  }
}]

Additional context Add any other context about the problem here.

TSunny007 commented 2 years ago

I don't think this is a swagger error since location is not required for when the deployment is in the RG scope (defaults to resource group location).

alex-frankel commented 2 years ago

The issue is that the location is required for all the other deployment scopes. We only default this for RG. Is there a way to reflect that in swagger?

alex-frankel commented 2 years ago

Unfortunately, there is no way to handle this complexity in swagger, so we will need to look into special casing the type definition in Bicep.

alex-frankel commented 2 years ago

Didn't mean to close