Mastercard / terraform-provider-restapi

A terraform provider to manage objects in a RESTful API
Other
785 stars 215 forks source link

fix #257 Adding option to set the obj id from a non JSON response #263

Open S3B4SZ17 opened 4 months ago

S3B4SZ17 commented 4 months ago

Summary

Addressing the #257 issue. If an API response with a non JSON formatted obj (a string or int i.e 1234 or my-string) we are going to use that value as the tf obj id. We need to set the id_attribute option as *.

Example

Example non-JSON response from the fakeserver:

curl 127.0.0.1:8080/api/objects -X POST -d '{ "Id": "1", "Name": "Foo", "No_json": true}'
1

That 1 will be used as the Obj ID

Tests

Under restapi/api_object_test.go created the create_object_no_json_response test case