Skip to content

Commit

Permalink
azurerm_network_security_group_association - prevent deadlock b… (#4501)
Browse files Browse the repository at this point in the history
* Fix a deadlock between network_security_group_association and network_interface, caused by them locking the same resources, but in a different order.

* Removed extra linebreak.
  • Loading branch information
nitzanm authored and katbyte committed Oct 5, 2019
1 parent fb922cf commit 4c93e42
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ func resourceArmSubnetNetworkSecurityGroupAssociationCreate(d *schema.ResourceDa
virtualNetworkName := parsedSubnetId.Path["virtualNetworks"]
resourceGroup := parsedSubnetId.ResourceGroup

locks.ByName(virtualNetworkName, virtualNetworkResourceName)
defer locks.UnlockByName(virtualNetworkName, virtualNetworkResourceName)

locks.ByName(subnetName, subnetResourceName)
defer locks.UnlockByName(subnetName, subnetResourceName)

locks.ByName(virtualNetworkName, virtualNetworkResourceName)
defer locks.UnlockByName(virtualNetworkName, virtualNetworkResourceName)

subnet, err := client.Get(ctx, resourceGroup, virtualNetworkName, subnetName, "")
if err != nil {
if utils.ResponseWasNotFound(subnet.Response) {
Expand Down

0 comments on commit 4c93e42

Please sign in to comment.