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,170 points
1,366 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
answered Sep 12, 2020 by MD
• 95,160 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,160 points
523 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,160 points
173 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,160 points
140 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,160 points
193 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,160 points
274 views