Azure / bicep-registry-modules

Bicep registry modules
MIT License
505 stars 351 forks source link

[AVM Module Issue]: AnotherOperationInProgress when deploying multiple subnets #1870

Closed marshalexander99 closed 6 months ago

marshalexander99 commented 6 months ago

Check for previous/existing GitHub issues

Issue Type?

Bug

Module Name

avm/res/network/virtual-network

(Optional) Module Version

0.1.5

Description

I have the following definition to deploy a hub virtual network.

param ResourcePrefix string
param azdns array
param onpremdns array
param domain bool = false

var dns = (domain) ? azdns : concat(onpremdns,azdns)

var dnsurl = 'privatelink.file.${environment().suffixes.storage}'

var hubvnetname = 'vnet-hub-01'

var hubvnet = {
  name: hubvnetname
  vnetAddressPrefixes : [
      '10.10.64.0/23'
    ]
    subnets: [
      {
        name: 'AzureFirewallSubnet'
        addressPrefix: '10.10.64.0/26'
      }
      {
        name: 'AzureFirewallManagementSubnet'
        addressPrefix: '10.10.64.64/26'
        routeTableResourceId: resourceId('Microsoft.Network/routeTables', 'rt-snet-fwmgt-01')
      }
      {
        name: 'GatewaySubnet'
        addressPrefix: '10.10.64.128/26'
        routeTableResourceId: resourceId('Microsoft.Network/routeTables', 'rt-snet-gw-01')
      }
      {
        name: 'AzureBastionSubnet'
        addressPrefix: '10.10.64.224/27'
        networkSecurityGroupResourceId: resourceId('Microsoft.Network/networkSecurityGroups', 'nsg-bastion-01')
      }
      {
        name: 'snet-shared'
        addressPrefix: '10.10.65.0/25'
        networkSecurityGroupResourceId: resourceId('Microsoft.Network/networkSecurityGroups', 'nsg-hub-01')
        routeTableResourceId: resourceId('Microsoft.Network/routeTables', 'rt-vnet-hub-01')
      }
      {
        name: 'snet-domain'
        addressPrefix: '10.10.65.128/26'
        networkSecurityGroupResourceId: resourceId('Microsoft.Network/networkSecurityGroups', 'nsg-hub-01')
        routeTableResourceId: resourceId('Microsoft.Network/routeTables', 'rt-vnet-hub-01')
      }
    ]
}

module deployhubvnet 'br/public:avm/res/network/virtual-network:0.1.5' = {
  name: 'deploy_${hubvnet.name}'
  scope: resourceGroup('rg-${ResourcePrefix}-platform-01-connectivity-01')
  params: {
    addressPrefixes: hubvnet.vnetAddressPrefixes
    name: hubvnet.name
    subnets: hubvnet.subnets
    dnsServers: dns
  }
}

resource privatednszone 'Microsoft.Network/privateDnsZones@2020-06-01' = {
  name: dnsurl
  location: 'global'
}

resource privatednszonelink 'Microsoft.Network/privateDnsZones/virtualNetworkLinks@2020-06-01' = {
  name: '${dnsurl}-link'
  location: 'global'
  parent: privatednszone
  properties: {
    registrationEnabled: false
    virtualNetwork: {
      id: deployhubvnet.outputs.resourceId
    }
  }
  dependsOn: [
    deployhubvnet
  ]
}

output hubvnet string = deployhubvnet.outputs.resourceId

I seem to be getting repeated errors stating AnotherOperationInProgress when the deployment re-runs. I believe this is related to the subnets all being deployed at once rather than with a batch size of 1. This doesn't happen all the time, just occasionally. Is there a way of resolving this using the module or am I best to resorting back to my original vnet deployment code?

(Optional) Correlation Id

14a7d25a-8556-4e3c-985b-02ada5aaa3c1

microsoft-github-policy-service[bot] commented 6 months ago

[!IMPORTANT] The "Needs: Triage :mag:" label must be removed once the triage process is complete!

[!TIP] For additional guidance on how to triage this issue/PR, see the BRM Issue Triage documentation.

[!NOTE] This label was added as per ITA06.

microsoft-github-policy-service[bot] commented 6 months ago

[!NOTE] The "Type: Bug :bug:" label was added as per ITA21.

avm-team-linter[bot] commented 6 months ago

@marshalexander99, thanks for submitting this issue for the avm/res/network/virtual-network module!

[!IMPORTANT] A member of the @Azure/avm-res-network-virtualnetwork-module-owners-bicep or @Azure/avm-res-network-virtualnetwork-module-contributors-bicep team will review it soon!

elbatane commented 6 months ago

Hi @marshalexander99 thank you for your issue. Please note that this is a duplication of https://github.com/Azure/bicep-registry-modules/issues/1519 and has been solved via https://github.com/Azure/bicep-registry-modules/pull/1771. I am going to close the issue. Thanks!