From d53c0649301cd8a7240b43825ce63a683f59624a Mon Sep 17 00:00:00 2001 From: Konstantinos Angelopoulos Date: Thu, 15 Jul 2021 17:04:29 +0200 Subject: [PATCH] `azurerm_subnet_network_security_group_association` fix potential deadlock when using multiple association resources. (#12267) --- .../subnet_network_security_group_association_resource.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azurerm/internal/services/network/subnet_network_security_group_association_resource.go b/azurerm/internal/services/network/subnet_network_security_group_association_resource.go index 337e54703b3d..da8def427515 100644 --- a/azurerm/internal/services/network/subnet_network_security_group_association_resource.go +++ b/azurerm/internal/services/network/subnet_network_security_group_association_resource.go @@ -76,12 +76,12 @@ func resourceSubnetNetworkSecurityGroupAssociationCreate(d *pluginsdk.ResourceDa virtualNetworkName := parsedSubnetId.Path["virtualNetworks"] resourceGroup := parsedSubnetId.ResourceGroup - locks.ByName(subnetName, SubnetResourceName) - defer locks.UnlockByName(subnetName, SubnetResourceName) - locks.ByName(virtualNetworkName, VirtualNetworkResourceName) defer locks.UnlockByName(virtualNetworkName, VirtualNetworkResourceName) + locks.ByName(subnetName, SubnetResourceName) + defer locks.UnlockByName(subnetName, SubnetResourceName) + subnet, err := client.Get(ctx, resourceGroup, virtualNetworkName, subnetName, "") if err != nil { if utils.ResponseWasNotFound(subnet.Response) {