Kong / terraform-provider-konnect

16 stars 3 forks source link

Data sources are not implemented correctly #10

Open scastria opened 2 months ago

scastria commented 2 months ago

The primary purpose of a data source is to lookup the id (or some other hard to find property) of something by a user friendly name. Just like a reference table in a DB. Take konnect_gateway_control_plane data source for example. This is an important data source as the control plane id is required for most other resources. Therefore, given the name of a control plane, I should be able to use the konnect_gateway_control_plane data source to lookup the control plane by name to then use the id it read as input to other resources. The konnect_gateway_control_plane data source is currently implemented with id as a required property and name as a computed property. That is backwards. name should be an required/optional input field and id should be the computed field. If I knew the value of id, then I wouldn't be using the data source to look it up in the first place.

scastria commented 2 months ago

I suspect that because this TF provider was auto-generated, that the control plane data source is probably not the only issue. Therefore, I suggest an audit of all data sources to make sure the id property is not required.