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_api_management - Restore request does not need to handle the response which does not have #21221

Merged
merged 2 commits into from
Apr 6, 2023
Merged
Changes from 1 commit
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
5 changes: 1 addition & 4 deletions internal/services/apimanagement/api_management_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -729,13 +729,10 @@ func resourceApiManagementServiceCreateUpdate(d *pluginsdk.ResourceData, meta in
},
}

future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, params)
_, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, params)
Copy link
Member

Choose a reason for hiding this comment

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

To give a little context here: this is returning an LRO, so there won't be a HTTP Response by design - this API behaviour is intentional and not an API bug. If you wish to query the state of a resource that's being provisioned as an LRO, you'll need to either poll on the LRO (using WaitForCompletion in the Track1 SDK) - or by polling on the resource and checking the provisioningState (as below) - although the LRO shouldn't be returning until this is completed, therefore polling on the LRO should be sufficient here

if err != nil {
return fmt.Errorf("recovering %s: %+v", id, err)
}
if err := future.WaitForCompletionRef(ctx, client.Client); err != nil {
return fmt.Errorf("waiting for recovery of %q: %+v", id, err)
}

// Wait for the ProvisioningState to become "Succeeded" before attempting to update
log.Printf("[DEBUG] Waiting for %s to become ready", id)
Expand Down