Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_route_server - update resource creation future. #19772

Merged
merged 1 commit into from
Jan 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still required if we poll on the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tombuildsstuff for the comments, yes, this is still needed as we need to get the resource provisioningStatus to ensure the resource is in a ready state.

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