terraform-provider-restapi
terraform-provider-restapi copied to clipboard
fix #257 Adding option to set the obj id from a non JSON response
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