crossplane-contrib / provider-upjet-gcp

Official GCP Provider for Crossplane by Upbound.
Apache License 2.0
60 stars 61 forks source link

[Bug]: Deleted or non-existent project fails Observe when `crossplane.io/external-name` set. #551

Open djeremiah opened 1 week ago

djeremiah commented 1 week ago

Is there an existing issue for this?

Affected Resource(s)

cloudplatform.gcp.upbound.io/v1beta1 - Project

Resource MRs required to reproduce the bug

apiVersion: cloudplatform.gcp.upbound.io/v1beta1
kind: Project
metadata:
  annotations:
    crossplane.io/external-name: PROJECT-ID
  name: PROJECT
spec:
  forProvider:
    name: PROJECT
    projectId: PROJECT-ID

Steps to Reproduce

Install Crossplane and provider-gcp-cloudplatform Deploy the MR

What happened?

Expected: the Project will be created Actual: the Observe phase fails with an error

Relevant Error Output Snippet

ReconcileError: observe failed: failed to observe the resource: [{0 the user does not have permission to access Project "{PROJECT-ID}" or it may not exist  []}]

Crossplane Version

1.16

Provider Version

1.3.0

Kubernetes Version

No response

Kubernetes Distribution

GKE

Additional Info

It looks like this may be expected behavior from GCP, passed through Terraform. https://github.com/hashicorp/terraform-provider-google/pull/6729 https://github.com/hashicorp/terraform-provider-google/blob/v5.19.0/google/services/resourcemanager/resource_google_project.go#L286-L301 The provider will need to interpret the error appropriately.