diff --git a/apis/compute/v1beta1/zz_address_types.go b/apis/compute/v1beta1/zz_address_types.go index d23faa447..0bd833cd0 100755 --- a/apis/compute/v1beta1/zz_address_types.go +++ b/apis/compute/v1beta1/zz_address_types.go @@ -63,6 +63,7 @@ type AddressParameters struct { // can only be used with INTERNAL type with the VPC_PEERING and // IPSEC_INTERCONNECT purposes. // +crossplane:generate:reference:type=Network + // +crossplane:generate:reference:extractor=github.com/upbound/provider-gcp/config/common.SelfLinkExtractor() // +kubebuilder:validation:Optional Network *string `json:"network,omitempty" tf:"network,omitempty"` @@ -103,6 +104,7 @@ type AddressParameters struct { // This field can only be used with INTERNAL type with // GCE_ENDPOINT/DNS_RESOLVER purposes. // +crossplane:generate:reference:type=Subnetwork + // +crossplane:generate:reference:extractor=github.com/upbound/provider-gcp/config/common.SelfLinkExtractor() // +kubebuilder:validation:Optional Subnetwork *string `json:"subnetwork,omitempty" tf:"subnetwork,omitempty"` diff --git a/apis/compute/v1beta1/zz_generated.resolvers.go b/apis/compute/v1beta1/zz_generated.resolvers.go index 8097e88c2..2e8e150f8 100644 --- a/apis/compute/v1beta1/zz_generated.resolvers.go +++ b/apis/compute/v1beta1/zz_generated.resolvers.go @@ -40,7 +40,7 @@ func (mg *Address) ResolveReferences(ctx context.Context, c client.Reader) error rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Network), - Extract: reference.ExternalName(), + Extract: common.SelfLinkExtractor(), Reference: mg.Spec.ForProvider.NetworkRef, Selector: mg.Spec.ForProvider.NetworkSelector, To: reference.To{ @@ -56,7 +56,7 @@ func (mg *Address) ResolveReferences(ctx context.Context, c client.Reader) error rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Subnetwork), - Extract: reference.ExternalName(), + Extract: common.SelfLinkExtractor(), Reference: mg.Spec.ForProvider.SubnetworkRef, Selector: mg.Spec.ForProvider.SubnetworkSelector, To: reference.To{ diff --git a/config/compute/config.go b/config/compute/config.go index 5fd2c494a..1b1a349a1 100644 --- a/config/compute/config.go +++ b/config/compute/config.go @@ -65,10 +65,12 @@ func Configure(p *config.Provider) { //nolint: gocyclo p.AddResourceConfigurator("google_compute_address", func(r *config.Resource) { r.References["network"] = config.Reference{ - Type: "Network", + Type: "Network", + Extractor: common.PathSelfLinkExtractor, } r.References["subnetwork"] = config.Reference{ - Type: "Subnetwork", + Type: "Subnetwork", + Extractor: common.PathSelfLinkExtractor, } config.MarkAsRequired(r.TerraformResource, "region") })