Skip to content

Deployment update request does not handle http code 400 #609

@gaojunling-wq

Description

@gaojunling-wq

Code of Conduct

This project has a Code of Conduct that all participants are expected to understand and follow:
[] I have read and agree to the project's Code of Conduct

vRA Version

vRA 8.18.1

Terraform Version

1.13.3

vRA Terraform Provider Version

0.15.0

Affected Resource(s)

vra_deployment with catalog item (cloud template)

Expected Behavior

Cloud template has configured to has enum list for an input:
During provisioning request, if sent bad value, provider get correct message for user:
Error: [POST /catalog/api/items/{id}/request][400] requestCatalogItemInstancesUsingPOST1BadRequest &{Message:input1: '"data"' is invalid. Expected value in '["titi", "toto"]'. StatusCode:400}

During update request, if sent bad value, provider should throw same error for input validation
Error: [POST /catalog/api/items/{id}/request][400] requestCatalogItemInstancesUsingPOST1BadRequest &{Message:input1: '"data"' is invalid. Expected value in '["titi", "toto"]'. StatusCode:400}

Actual Behavior

Actually we got an error message without any detail:
Error: response status code does not match any response statuses defined for this endpoint in the swagger spec (status 400): {}

In fact, the error message is sent back by vRA http 400 but not handled by provider correctly:
{
"message": "Validation failed with: $.inputs.input1: Value 'data' is not in list of valid values ["titi", "toto"]",
"statusCode": 400,
"errorCode": 24002
}

Steps to Reproduce

  1. have a cloud template with enum list for a list:

inputs:
input1:
type: string
default: toto
enum:
- titi
- toto

  1. deploy the vm with terraform (with value "toto" for input1 )and try update it with a bad value (value "data" for input1 )

Screenshots

Image

Debug output

Image

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions