Skip to content

Commit

Permalink
azurerm_route_server - update resource creation future. (#19772)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaxyi committed Jan 3, 2023
1 parent cad5c78 commit 80fec02
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/services/network/route_server_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,15 @@ func resourceRouteServerCreateUpdate(d *pluginsdk.ResourceData, meta interface{}
Tags: t,
}

if _, err := serverClient.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, parameters); err != nil {
serverFuture, err := serverClient.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, parameters)
if err != nil {
return fmt.Errorf("creating Route Server %q (Resource Group Name %q): %+v", id.Name, id.ResourceGroup, err)
}

if err := serverFuture.WaitForCompletionRef(ctx, serverClient.Client); err != nil {
return fmt.Errorf("waiting for creation of %s: %+v", id, err)
}

timeout, _ := ctx.Deadline()
stateConf := &pluginsdk.StateChangeConf{
Pending: []string{"Provisioning", "Updating"},
Expand All @@ -153,7 +158,7 @@ func resourceRouteServerCreateUpdate(d *pluginsdk.ResourceData, meta interface{}
ContinuousTargetOccurence: 5,
Timeout: time.Until(timeout),
}
_, err := stateConf.WaitForStateContext(ctx)
_, err = stateConf.WaitForStateContext(ctx)
if err != nil {
return fmt.Errorf("waiting for creation/update of Route Server %q (Resource Group Name %q): %+v", id.Name, id.ResourceGroup, err)
}
Expand Down

0 comments on commit 80fec02

Please sign in to comment.