You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently attempting to update a resource that supports the PUT operation and return a successful response 204 with no content in the response body fails.
If the target resource does have a current representation and that representation is successfully modified in accordance with the state of the enclosed representation, then the origin server must send either a 200 (OK) or a 204 (No Content) response to indicate successful completion of the request.
To Reproduce
A clear and concise description on how does it work now and what's the current behaviour.
Steps to reproduce the behavior:
Given the OpenAPI spec below
And having already provisioned the resource through terraform:
Attempting to update the resource will result into the following error:
$ cat main.tf
resource "openapi_authority" "my_authority" {
label = "some updated label"
}
$ terraform apply
....
Error: expected a response body but response body received was empty for request = 'PUT https://some-domain.com/authorities/3b2f5849-5282-4b83-981b-5731cd8e6228 HTTP/1.1'. Response = '204 No Content'
Expected behaviour
Example:
Scenario: Update works for resources where the PUT operation returns 204 with no content in the bodyGiven a compatible OpenAPI Terraform resource (as shown below) that exposes a PUT operation and the successful response is 204 with no content in the response body
When updating the resource after a successful creation in terraform
Then the apply should work as expected and the resulted state should contain the updated properties values as well as any other computed properties that were already in the state file for the resource updated.
Example OpenAPI document:
swagger: '2.0'
paths:
post:
x-terraform-resource-name: authority
tags:
- authorities
summary: Create a Authority
description: Allows the creation of a Authority
operationId: createAuthority
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: Authority
required: true
schema:
$ref: '#/definitions/Authority'
responses:
'200':
description: 200 OK
schema:
$ref: '#/definitions/Authority'
'404':
description: 404 NotFound
schema:
$ref: '#/definitions/Error'
'500':
description: 500 InternalError
schema:
$ref: '#/definitions/Error'
/authorities/{id}:
get:
tags:
- authorities
summary: Get an existing Authority
description: Get an already existing Authority
operationId: getAuthority
consumes:
- application/json
produces:
- application/json
parameters:
- type: string
description: The authority id to be fetched
name: id
in: path
required: true
responses:
'200':
description: 200 OK
schema:
$ref: '#/definitions/Authority'
'404':
description: 404 NotFound
schema:
$ref: '#/definitions/Error'
'500':
description: 500 InternalError
schema:
$ref: '#/definitions/Error'
put:
tags:
- authorities
summary: Update an existing Authority
description: Update an already existing Authority
operationId: updateAuthorityUsingPut
parameters:
- type: string
description: The authority id to be fetched
name: id
in: path
required: true
- in: body
name: data
required: true
schema:
$ref: '#/definitions/Authority'
responses:
'204':
description: 204 No Content
'404':
description: 404 NotFound
schema:
$ref: '#/definitions/Error'
'500':
description: 500 InternalError
schema:
$ref: '#/definitions/Error'
Authority:
type: object
required:
- label
description: Authority model
properties:
id:
type: string
readOnly: true
description: Autogenerated UUID that identifies this authority
example: "9662edf7-bdf4-40b5-9b6e-614baa816da9"
label:
type: string
pattern: '^[a-zA-Z0-9_:\-\s]{1,64}$'
description: Friendly label to help identify the authority
example: "demo-authority"
Additional context
Add any other context about the problem here.
Checklist (for admin only)
Don't forget to go through the checklist to make sure the issue is created properly:
I have added a corresponding label (bug) to the issue (right side menu)
I have added this issue to the 'API Terraform Provider' GitHub project (right side menu)
The text was updated successfully, but these errors were encountered:
Describe the bug
Currently attempting to update a resource that supports the PUT operation and return a successful response 204 with no content in the response body fails.
As per the PUT specification:
To Reproduce
A clear and concise description on how does it work now and what's the current behaviour.
Steps to reproduce the behavior:
Expected behaviour
Example:
Additional context
Add any other context about the problem here.
Checklist (for admin only)
Don't forget to go through the checklist to make sure the issue is created properly:
The text was updated successfully, but these errors were encountered: