-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
restapi_object data is not optional #260
Comments
I have the same situation. I have an api that reads and deletes works without receive data. It only works set the id on the path. curl --location 'https://xxxxxxxx.com/api/v2/firewall/alias?id=21' \
--header 'x-api-key: xxxxxxxx' \ But when use terraform always send a data and then my API needs a few parameters on payload that I cant send. 2024-10-22T14:25:51.013+0200 [INFO] provider.terraform-provider-restapi_v1.20.0: 2024/10/22 14:25:51 api_client.go: method='GET', path='/api/v2/firewall/alias?id=18', full uri (derived)='https://xxxxxxx.com/api/v2/firewall/alias?id=18', data='': timestamp="2024-10-22T14:25:51.013+0200" note the Error: unexpected response code '400': {"code":400,"status":"bad request","response_id":"MODEL_REQUIRES_ID","message":"Field `id` is required.","data":[]} Maybe the option that sugest Justin-DynamicD in this comment, Adding a few parameters can be a valid solution: create_include_data = false
destroy_include_data = false
read_include_data = false |
I have solved this error by removing the |
right now data is a required string for the
restapi_object
, which causes issues with some providers.Notably CircleCI uses a curl POST with no data to create a new project, with configurations added by a separate call.
(https://circleci.com/docs/api/v2/index.html#operation/createProject)
vs.
(https://circleci.com/docs/api/v2/index.html#operation/patchProjectSettings)
To clarify, a get will still return a valid object with ID, it's just that initial POST needs to be empty :(
I can easily use update_path to make changes, but I cannot omit a default data variable during the initial create, nor even make them two different resources as the resource requires a data value.
The text was updated successfully, but these errors were encountered: