ionos-cloud / terraform-provider-ionoscloud

The IonosCloud Terraform provider gives the ability to deploy and configure resources using the IonosCloud APIs.
Mozilla Public License 2.0
33 stars 21 forks source link

fix: Fix 'lans' attribute for DataPlatform clusters #553

Closed adeatcu-ionos closed 2 months ago

adeatcu-ionos commented 2 months ago

What does this fix or implement?

Fixes the first point presented here: https://github.com/ionos-cloud/terraform-provider-ionoscloud/issues/552.

Before this fix, if the lans wasn't present in the tf file, lans: nil would be send in the request, same for routes.

This led to a validation error since the API accepts lans: null only on PATCH requests, routes: null is not accepted at all. The error looks like this:

│ Error: an error occured  while creating a Dataplatform Cluster: 422 Unprocessable Entity: {"httpStatus":422,"messages":[{"errorCode":"dsaas-400","message":"'Value is not nullable' caused by field /properties/lans"}]}

I modified the code and now, if the lans or routes are missing, instead of nil we send an empty list in the body request.

Checklist

sonarcloud[bot] commented 2 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud