crossplane-contrib / provider-upjet-aws

Official AWS Provider for Crossplane by Upbound.
https://marketplace.upbound.io/providers/upbound/provider-aws
Apache License 2.0
137 stars 112 forks source link

Use config.Reference.TerraformName instead of config.Reference.Type #1310

Closed ulucinar closed 1 month ago

ulucinar commented 1 month ago

Description of your changes

This PR replaces usages of upjet's config.Reference.Type API with config.Reference.TerraformName. In https://github.com/crossplane/upjet/pull/400, we are deprecating the config.Reference.Type API in favor of config.Reference.TerraformName. config.Reference.TerraformName is a more stable and less error prone API compared to config.Reference.Type because it automatically accounts for the configuration changes affecting the cross-resource reference target's kind name, group or version. We've already been discouraging the config.Reference.Type in favor of config.Reference.TerraformName since it's been introduced.

This PR is a precursor for converting the singleton list APIs to embedded objects. When the config.Reference.Type is used to define the reference target, the API version can be omitted for the targets in the same group and version. In those cases, if the referencing resource has been generated at v1beta2 whereas the reference target lacks that version, the generated resolver is not valid. Using config.Reference.TerraformName instead will help us in future maintenance because it automatically accounts for generating the cross-resource reference resolvers in the generated version. This is also one of the reasons we are deprecating config.Reference.Type.

I have:

How has this code been tested

Checked for any unexpected changes in the generated resolvers (apis/../zz_generated.resolvers.go files).