udoma-co / terraform-provider-udoma

A Terraform Provider for managing configuration and customizations for Udoma accounts
2 stars 0 forks source link

Ignore unknown json fields when reading from API #22

Open realvasko opened 5 months ago

realvasko commented 5 months ago

Currently, when there is a change to the API and a new field is introduced that is not yet added to the provider, any plan or apply operation will fail with the following error message:

Could not read entity from Udoma, unexpected error: json: unknown field "<field name>":

This can be handled by checking the type of error the JSON unmarshaller returns and ignoring it in case it is json.UnmarshalTypeError (same way it's done in the backend).

realvasko commented 5 months ago

Unfortunately this won't work. The error that is being thrown is coming from deep inside the generated client code and it 1. does not do proper error wrapping, and 2. returns an empty object in case of an error during unmarshalling