diff --git a/internal/services/network/network_manager_deployment_resource.go b/internal/services/network/network_manager_deployment_resource.go index 6a87f9fe4a08..b0f05443d386 100644 --- a/internal/services/network/network_manager_deployment_resource.go +++ b/internal/services/network/network_manager_deployment_resource.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/networkmanagers" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" @@ -108,6 +109,9 @@ func (r ManagerDeploymentResource) Create() sdk.ResourceFunc { normalizedLocation := azure.NormalizeLocation(state.Location) id := parse.NewNetworkManagerDeploymentID(networkManagerId.SubscriptionId, networkManagerId.ResourceGroupName, networkManagerId.NetworkManagerName, normalizedLocation, state.ScopeAccess) + locks.ByID(id.ID()) + defer locks.UnlockByID(id.ID()) + metadata.Logger.Infof("creating %s", *id) listParam := networkmanagers.NetworkManagerDeploymentStatusParameter{ @@ -214,6 +218,9 @@ func (r ManagerDeploymentResource) Update() sdk.ResourceFunc { return err } + locks.ByID(id.ID()) + defer locks.UnlockByID(id.ID()) + metadata.Logger.Infof("updating %s..", *id) client := metadata.Client.Network.NetworkManagers @@ -294,6 +301,9 @@ func (r ManagerDeploymentResource) Delete() sdk.ResourceFunc { return err } + locks.ByID(id.ID()) + defer locks.UnlockByID(id.ID()) + metadata.Logger.Infof("deleting %s..", *id) input := networkmanagers.NetworkManagerCommit{ ConfigurationIds: &[]string{},