pulumi / pulumi-google-native

Apache License 2.0
71 stars 18 forks source link

Can't manage firebase resources due to missing userProjectOverride flag #903

Open geekflyer opened 1 year ago

geekflyer commented 1 year ago

What happened?

Creating or using any firebase resources fails with:

Diagnostics:
  pulumi:pulumi:Stack (aptos-api-gateway-testnet-staging):
    error: Running program 'main.pulumi.ts' failed with an unhandled exception:
    <ref *1> Error: invocation of google-native:firebasehosting/v1beta1:getDomain returned an error: error sending request: googleapi: Error 403: Your application is authenticating by using local Application Default Credentials. The firebasehosting.googleapis.com API requires a quota project, which is not set by default. To learn how to set your quota project, see https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds.
    Details:
    [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "domain": "googleapis.com",
        "metadata": {
          "consumer": "projects/62555940559",
          "service": "firebasehosting.googleapis.com"
        },
        "reason": "SERVICE_DISABLED"
      }
    ]

Note I'm getting the same error with the gcp classic provider unless gcp:userProjectOverride: true is set in the pulumi config (see https://www.pulumi.com/registry/packages/gcp/api-docs/provider/#userprojectoverride_nodejs and https://firebase.google.com/docs/projects/terraform/get-started#general-workflow-set-up-provider on why this is necessary). Unfortunately the google native provider doesn't have an equivalent flag and I couldn't figure out how to make this work otherwise.

Expected Behavior

should work

Steps to reproduce

  1. create a firebase gcp project (manually is fine) and enable firebase hosting.
  2. gcloud auth login --update-adc
  3. Create some pulumi code like:
    gcpv2.firebasehosting.v1beta1.getDomainOutput({
    domainId: "foo.bar.com",
    project: 'my-gcp-project',
    siteId: 'my-gcp-project',
    }

Output of pulumi about

CLI
Version 3.69.0 Go Version go1.20.4 Go Compiler gc

Plugins NAME VERSION nodejs unknown

Host
OS darwin Version 13.4 Arch arm64

This project is written in nodejs: executable='/Users/christian/Library/Caches/fnm_multishells/3608_1687219398510/bin/node' version='v18.16.0'

Found no pending operations associated with testnet-staging

Backend
Name pulumi.com

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

rquitales commented 1 year ago

Hi @geekflyer, thank you for reporting this issue, and we apologize for the inconvenience it has caused. Unfortunately, at the moment, there is no available workaround within the Google Native provider for this particular issue.

The underlying issue lies in the fact that our HTTP client does not support injecting the necessary request headers to enable the desired feature. Specifically, we need to add support for specifying the X-Goog-User-Project header, which allows you to specify a custom billing project. Rest assured, we will prioritize adding this functionality to address the issue.

rvadim commented 9 months ago

The same issue with v1/v1beta1 billing budgets

[
  {
    "@type": "type.googleapis.com/google.rpc.ErrorInfo",
    "domain": "googleapis.com",
    "metadata": {
      "consumer": "projects/764086051850",
      "service": "billingbudgets.googleapis.com"
    },
    "reason": "SERVICE_DISABLED"
  }
]