terraform-provider-restapi icon indicating copy to clipboard operation
terraform-provider-restapi copied to clipboard

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

Open S3B4SZ17 opened this issue 1 year ago • 2 comments

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

S3B4SZ17 avatar Mar 10 '24 03:03 S3B4SZ17