crossplane / terrajet

Generate Crossplane Providers from any Terraform Provider
https://crossplane.io
Apache License 2.0
289 stars 38 forks source link

Generate resource types based on data sources #164

Closed displague closed 2 years ago

displague commented 2 years ago

What problem are you facing?

Datasources in Terraform offer a way for users to query data from the provider API and repurpose the results of that query in other resources.

Terrajet does not offer a means of generating datasource based resources. (Or it is not documented, a search of data source and datasource returns nothing).

How could Terrajet help solve your problem?

Implement data source resources.

Just as in normal resources, the forProvider and atProvider would represent the resource parameters and attributes.

Name collisions would be very likely with other resources. It is common to offer a provider_foo resource and a provider_foo datasource. These resources may have the same attributes or the attributes may differ. It is very common for the parameters to differ. A patterned prefix or name alteration would need to be established. (type.group.data.jet.crossplane.io?)

It will be common for compositions to draw referencer fields from either a data source or a resource. Is support present for equating reference fields across multiple types? (provider_foo.special_field is the same unique upstream value wether it comes from a resource or a datasource. The matching field name should not be used to denote this feature of attributes because one resource may use a different field name to represent the same field in another resource. From a referencer perspective, I may wish to use any of the resources that provide this field).

Related to https://github.com/crossplane/crossplane/issues/1722

displague commented 2 years ago

I missed that this may be a duplicate of https://github.com/crossplane-contrib/terrajet/issues/127

Feel free to close this if you feel the same way you did in #127.

muvaf commented 2 years ago

@displague Thanks for raising the issue! Yes, I believe the reasons we closed that issue still hold. Let's track observe-only resource feature there.