diff --git a/azurerm/resource_arm_network_security_group.go b/azurerm/resource_arm_network_security_group.go index 59983801e3f5..750b75471089 100644 --- a/azurerm/resource_arm_network_security_group.go +++ b/azurerm/resource_arm_network_security_group.go @@ -139,6 +139,9 @@ func resourceArmNetworkSecurityGroupCreate(d *schema.ResourceData, meta interfac return fmt.Errorf("Error Building list of Network Security Group Rules: %s", sgErr) } + azureRMLockByName(name, networkSecurityGroupResourceName) + defer azureRMUnlockByName(name, networkSecurityGroupResourceName) + sg := network.SecurityGroup{ Name: &name, Location: &location, diff --git a/azurerm/resource_arm_virtual_network.go b/azurerm/resource_arm_virtual_network.go index a07ab74d573f..d76c7af96f1b 100644 --- a/azurerm/resource_arm_virtual_network.go +++ b/azurerm/resource_arm_virtual_network.go @@ -116,8 +116,8 @@ func resourceArmVirtualNetworkCreate(d *schema.ResourceData, meta interface{}) e } } - azureRMLockMultipleByName(&networkSecurityGroupNames, virtualNetworkResourceName) - defer azureRMUnlockMultipleByName(&networkSecurityGroupNames, virtualNetworkResourceName) + azureRMLockMultipleByName(&networkSecurityGroupNames, networkSecurityGroupResourceName) + defer azureRMUnlockMultipleByName(&networkSecurityGroupNames, networkSecurityGroupResourceName) _, error := vnetClient.CreateOrUpdate(resGroup, name, vnet, make(chan struct{})) err := <-error