Skip to content

Commit

Permalink
azurerm_firewall_policy - wait for completion after calling create (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
magodo authored Feb 24, 2022
1 parent 370c55d commit 21eb004
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/services/firewall/firewall_policy_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,12 @@ func resourceFirewallPolicyCreateUpdate(d *pluginsdk.ResourceData, meta interfac
locks.ByName(id.Name, azureFirewallPolicyResourceName)
defer locks.UnlockByName(id.Name, azureFirewallPolicyResourceName)

if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, props); err != nil {
return fmt.Errorf("creating %s: %+v", id, err)
future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, props)
if err != nil {
return fmt.Errorf("creating/updating %s: %+v", id, err)
}
if err := future.WaitForCompletionRef(ctx, client.Client); err != nil {
return fmt.Errorf("waiting for creating/updating %s: %+v", id, err)
}

d.SetId(id.ID())
Expand Down

0 comments on commit 21eb004

Please sign in to comment.