-
Notifications
You must be signed in to change notification settings - Fork 78
Description
Hello friends
When I run tf apply resulting in an update in-place action against an azapi_data_plane_resource utilizing the Microsoft.Search/searchServices API, a 204 is returned on success, which causes Terraform to mark the apply as failed.
Issue 440 discusses the same issue, but for azapi_resource_action. Fix 441 added http.StatusNoContent to success response codes in internal/clients/resource_client.go.
The equivalent in internal/clients/data_plane_client.go does not contain http.StatusNoContent, resulting in a 204 being treated as a failure.
Error encountered (initial creation works fine, modifications result in update in-place fail):
│ Error: Failed to create/update resource
│
│ with azapi_data_plane_resource.default_datasource,
│ on main.tf line 1241, in resource "azapi_data_plane_resource" "default_datasource":
│ 1241: resource "azapi_data_plane_resource" "default_datasource" {
│
│ creating/updating "Resource: (ResourceId
│ \"srch-d-eus2.search.windows.net/datasources('default-datasource')\"
│ / Api Version \"2024-07-01\")": PUT
│ https://srch-d-eus2.search.windows.net/datasources('default-datasource')
│ --------------------------------------------------------------------------------
│ RESPONSE 204: 204 No Content
│ ERROR CODE UNAVAILABLE
│ --------------------------------------------------------------------------------
│ Response contained no body
│ --------------------------------------------------------------------------------
As with Issue 440, it seems azapi should treat a 204 as succes. Azure AI Search HTTP status codes in the API reference show 204 as a "Success on PUT or POST".
Proposed fix is to follow the pattern from fix 441 by adding http.StatusNoContent to data_plane_client.go
Thanks