Use config.Reference.TerraformName instead of config.Reference.Type #739
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of your changes
This PR replaces usages of upjet's
config.Reference.Type
API withconfig.Reference.TerraformName
. In crossplane/upjet#400, we are deprecating theconfig.Reference.Type
API in favor ofconfig.Reference.TerraformName
. We had introducedconfig.Reference.TerraformName
in crossplane/upjet#12 and it's a more stable and less error prone API compared toconfig.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 theconfig.Reference.Type
in favor ofconfig.Reference.TerraformName
since it's been introduced.This PR is a precursor for #733, in which we will start generating the
v1beta2
APIs for certain resources (those with singleton lists in their Terraform schemas). When theconfig.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 atv1beta2
whereas the reference target lacks that version, the generated resolver is not valid. Usingconfig.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 deprecatingconfig.Reference.Type
.I have:
make reviewable
to ensure this PR is ready for review.backport release-x.y
labels to auto-backport this PR if necessary.How has this code been tested
A successful uptest run is registered here for a resource affected by this change: https://github.com/crossplane-contrib/provider-upjet-azure/actions/runs/9037709362/
Also checked for any unexpected changes in the generated resolvers (
apis/../zz_generated.resolvers.go
files).