Mastercard / terraform-provider-restapi

A terraform provider to manage objects in a RESTful API
Other
808 stars 217 forks source link

Tolerate 200 OK with empty response #226

Closed alahijani closed 7 months ago

alahijani commented 1 year ago

Fixes #178.

Background: restapi currently tolerates a 200 OK response with {} as the body, but it doesn't accept the empty string as the HTTP response body. This commit changes the behavior for an empty response to match that of {}.

In both cases the user would still need to provide the object_id explicitly for this to work.

This is a rather common case, as the number of responses to #178 shows.

splattner commented 1 year ago

Facing the same with this API Call https://try.gitea.io/api/swagger#/organization/orgAddTeamMember

alahijani commented 1 year ago

Wondering what it takes to have this merged. I can add new tests for this case if that is required.

bradenwright-opunai commented 1 year ago

Any update on getting this merged, this is an issue for me, as well as a number of other people. It literally a one line change, hopefully it can be merged soon.

bradenwright-opunai commented 1 year ago

@alahijani I was trying to build my own provider and test this until its able to be merged, but I got an error when testing. I posted details https://github.com/Mastercard/terraform-provider-restapi/issues/178#issuecomment-1696624995 not sure if that's the best place I can always move it.

Details have info about how I built and setup a custom provider with your change in it, details on terraform code I'm testing (b/c I could be setting something up wrong). For visibility the error I'm getting is:

restapi_object.system_settings_setup: Creating...
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to restapi_object.system_settings_setup, provider "provider[\"example.com/test/restapi\"]" produced an unexpected new value: Root resource was present, but now absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
bradenwright-opunai commented 1 year ago

Any thoughts or updates on https://github.com/Mastercard/terraform-provider-restapi/pull/226#issuecomment-1696628498 I'd really like to use this provider but this is blocking me.

bradenwright commented 10 months ago

Any updates on when this will get merged?

kbcz1989 commented 7 months ago

Any chance to get this merged?

DRuggeri commented 7 months ago

Thanks, @alahijani - agreed that this is a pretty straight forward change and makes a lot of sense.

Also, thanks for the patience! As mentioned in the readme, we keep the provider up to date but features are ssssllllloooooowwwwww.

jarpoole commented 7 months ago

Thank you for your continued commitment to the project!

DRuggeri commented 7 months ago

Right on - this will be released in 1.19.0 which is building now!

bradenwright commented 7 months ago

Thanks thats great news!