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

Conversation

xuzhang3
Copy link
Contributor

Fixes: #17206
This recover request is different from the create/update. The response does not have any response body or HTTP headers like create/update. A successful recover request will have an HTTP status code of 201. Handle the response error is enough.

=== RUN   TestAccApiManagement_softDeleteRecovery
=== PAUSE TestAccApiManagement_softDeleteRecovery
=== CONT  TestAccApiManagement_softDeleteRecovery
--- PASS: TestAccApiManagement_softDeleteRecovery (959.33s)
PASS

Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

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

Hey @xuzhang3, this looks like an api bug if the future isn't working correctly. I believe we'll have to merge this the way it is since it is broken but can you open an api ticket and link that into a comment on this PR so we can track when it'll be fixed?

@xuzhang3
Copy link
Contributor Author

xuzhang3 commented Apr 6, 2023

APIM issue: Azure/azure-rest-api-specs#23456

@stephybun stephybun added the bug label Apr 6, 2023
Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

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

Thanks @xuzhang3 in future please make sure to leave a comment in the code linking to the raised issue. LGTM 👍

@stephybun stephybun merged commit 9546135 into hashicorp:main Apr 6, 2023
@github-actions github-actions bot added this to the v3.51.0 milestone Apr 6, 2023
stephybun added a commit that referenced this pull request Apr 6, 2023
@@ -729,13 +729,11 @@ func resourceApiManagementServiceCreateUpdate(d *pluginsdk.ResourceData, meta in
},
}

future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, params)
// We only handle the error here because no request body is returned https://github.com/Azure/azure-rest-api-specs/issues/23456
_, 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

@github-actions
Copy link

This functionality has been released in v3.51.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

azurerm_api_management fails to apply on 3.10.0 provider
4 participants