hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.29k stars 1.72k forks source link

Allow autogeneration of singular data sources #12595

Open melinath opened 1 year ago

melinath commented 1 year ago

Affected Resource(s)

Data sources are currently all handwritten; however, they are fairly simple. We should allow autogeneration so that we can more cheaply support the existing data sources and also more easily add new ones.

rileykarson commented 1 year ago

Discussed in chat recently after @ScottSuarez brought this up. Context from there: most singular datasources (i.e. data.google_compute_address are of limited utility, and this has not proven the best use of our time to work on. Plural datasources (i.e. data.google_compute_addresses) would be slightly more useful in conventional configurations.

The most value comes from custom datasources generally, though, without corresponding resources.

ScottSuarez commented 1 year ago

My concern with datasources implemented manually is that sometimes they don't use the resource read or even schema. This leads to datasources becoming out of date with resource implementation. I would rather have flag to flip to turn on datasource* generation if we want to keep it an opt-in thing. Thus ensuring consistency in implementation design and less foreseeable maintenance.

rileykarson commented 1 year ago

Yes, older datasources were handwritten. We avoid those now for the reasons you've mentioned and use the datasource wrapper for singular datasources. That's a separate topic than my comment which addresses why generating these has not been particularly high priority- singular datasources are not particularly valuable for end users in most cases.

I would rather have flag to flip to turn on dataset generation if we want to keep it an opt-in thing.

Datasource?

ScottSuarez commented 1 year ago

mistype, mm gotcha !