Error No credentials loaded To use your gcloud credentials run gcloud auth application-default login

0 votes

Hi Guys,

I am new to Terraform. I am trying to use the GCP cloud resource from Terraform. But I am getting the below error.

$ terraform apply

Error: Attempted to load application default credentials since neither `credentials` nor `access_token` was 
set in the provider block.  No credentials loaded. To use your gcloud credentials, run 'gcloud auth application-default login'.  Original error: google: could not find default credentials. See
https://developers.google.com/accounts/docs/application-default-credentials for more information.                                                                                                                                                         on main.tf line 1, in provider "google":
1: provider "google" {
Sep 11, 2020 in Terraform by akhtar
• 38,230 points
4,343 views

1 answer to this question.

0 votes

Hi@akhtar,

You are trying to connect the GCP cloud from Terraform. Terraform will use the GCP SDK to connect to your project. But the first time you have to manually login to your GCP cloud from the command line using the below-given command.

$ gcloud auth application-default login


Hope this helped!!

To know more about Google Cloud, It is recommended to go for Google Cloud Certification training today.

Thank you!

answered Sep 12, 2020 by MD
• 95,440 points

Related Questions In Terraform

0 votes
1 answer

How to use dynamic resource names in Terraform?

Hi@akhtar, I recommend using a different workspace for each ...READ MORE

answered Dec 7, 2020 in Terraform by MD
• 95,440 points
2,578 views
0 votes
1 answer
0 votes
1 answer

How to use GCP provider in Terraform?

Hi@akhtar, Terraform supports many providers to deploy the ...READ MORE

answered Sep 12, 2020 in Terraform by MD
• 95,440 points
518 views
0 votes
1 answer

How to launch an instance in GCP using Terraform?

Hi@akhtar, You can use the google_compute_instance resource in ...READ MORE

answered Sep 12, 2020 in Terraform by MD
• 95,440 points
644 views
0 votes
1 answer

Create a project in GCP using Terraform.

Hi@akhtar, Terraform has a resource named google_project. This ...READ MORE

answered Sep 13, 2020 in Terraform by MD
• 95,440 points
775 views
0 votes
1 answer
0 votes
1 answer

How to run local command using terraform?

Hi@akhtar, You can use provisioner keyword to run ...READ MORE

answered Jun 15, 2020 in Terraform by MD
• 95,440 points
1,641 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP