|
9 | 9 | "github.com/hashicorp/go-azure-helpers/resourcemanager/location"
|
10 | 10 | "github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
|
11 | 11 | "github.com/hashicorp/terraform-provider-azurerm/internal/clients"
|
| 12 | + "github.com/hashicorp/terraform-provider-azurerm/internal/locks" |
12 | 13 | "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse"
|
13 | 14 | "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate"
|
14 | 15 | "github.com/hashicorp/terraform-provider-azurerm/internal/tags"
|
@@ -183,6 +184,9 @@ func resourceNetworkWatcherFlowLogCreateUpdate(d *pluginsdk.ResourceData, meta i
|
183 | 184 | nsgId, _ := parse.NetworkSecurityGroupID(networkSecurityGroupID)
|
184 | 185 | id := parse.NewFlowLogID(subscriptionId, resourceGroupName, networkWatcherName, *nsgId)
|
185 | 186 |
|
| 187 | + locks.ByID(nsgId.ID()) |
| 188 | + defer locks.UnlockByID(nsgId.ID()) |
| 189 | + |
186 | 190 | loc := d.Get("location").(string)
|
187 | 191 | if loc == "" {
|
188 | 192 | // Get the containing network watcher in order to reuse its location if the "location" is not specified.
|
@@ -296,6 +300,9 @@ func resourceNetworkWatcherFlowLogDelete(d *pluginsdk.ResourceData, meta interfa
|
296 | 300 | return err
|
297 | 301 | }
|
298 | 302 |
|
| 303 | + locks.ByID(id.NetworkSecurityGroupID()) |
| 304 | + defer locks.UnlockByID(id.NetworkSecurityGroupID()) |
| 305 | + |
299 | 306 | future, err := client.Delete(ctx, id.ResourceGroupName, id.NetworkWatcherName, id.Name())
|
300 | 307 | if err != nil {
|
301 | 308 | return fmt.Errorf("deleting %s: %v", id, err)
|
|
0 commit comments