Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 403: Your application is authenticating by using local Application Default Credentials #25

Open
natea opened this issue Jul 17, 2024 · 5 comments

Comments

@natea
Copy link

natea commented Jul 17, 2024

I'm trying to run the command: terraform -chdir=terraform apply -auto-approve and the following error is occurring:

│ Error: Error creating InspectTemplate: googleapi: Error 403: Your application is authenticating by using local Application Default Credentials. The dlp.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/764086051850",
│       "service": "dlp.googleapis.com"
│     },
│     "reason": "SERVICE_DISABLED"
│   }
│ ]
│
│   with module.pdf_redactor.google_data_loss_prevention_inspect_template.dlp_pdf_template,
│   on pdf-redactor/dlp.tf line 15, in resource "google_data_loss_prevention_inspect_template" "dlp_pdf_template":
│   15: resource "google_data_loss_prevention_inspect_template" "dlp_pdf_template" {

I then followed the suggested help doc https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds where it suggests to run the command gcloud auth application-default set-quota-project YOUR_PROJECT

So I ran that command with my project name.

$ gcloud auth application-default set-quota-project aeropsychiatry

Credentials saved to file: [/Users/nateaune/.config/gcloud/application_default_credentials.json]

These credentials will be used by any library that requests Application Default Credentials (ADC).

Quota project "aeropsychiatry" was added to ADC which can be used by Google client libraries for billing and quota. Note that some services may still bill the project owning the resource.

But I get the same error as before. Any ideas what might be going wrong?

@felimartina
Copy link
Collaborator

Hey @natea - are you running this using a project with billing enabled on it? or is it a free trial project?

@flolopdel
Copy link

Hello!

I am experiencing the same issue. I did all kind of test and search, but it's still saying the service is disabled.

I can create an inspect template properly from the Google cloud console. Any ideas to test it?

@natea
Copy link
Author

natea commented Aug 26, 2024 via email

@jayBana
Copy link

jayBana commented Oct 25, 2024

We did run into this issue as well and got resolved by adding the billing_project and user_project_override the provider block in dlp-pdf-redaction/terraform/pdf-redactor/main.tf

provider  "google" {
  project = var.project_id
  region  = var.region
  billing_project = var.project_id
  user_project_override = true
}

See for reference describing a similar issue, but with another GCP service:
hashicorp/terraform-provider-google#15066

@felimartina
Copy link
Collaborator

Hey @jayBana thanks for chiming in and sharing the work around. Would you say we should add those two settings to the provider by default?

@natea @flolopdel - can you please confirm if the change above fixes the problem for you? If so then I can go ahead and merge those changes to make it the default.

PS: Apologies for the slow reply in here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants