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

Correct default GCP env var for credential path in Guide #5021

Merged
merged 2 commits into from
Dec 4, 2019
Merged

Correct default GCP env var for credential path in Guide #5021

merged 2 commits into from
Dec 4, 2019

Conversation

draconteus
Copy link
Contributor

No description provided.

Correct default GCP env var for credential path
@ghost ghost added the size/xs label Nov 29, 2019
@ghost ghost requested a review from megan07 November 29, 2019 14:14
@ghost ghost added the documentation label Nov 29, 2019
@@ -161,7 +161,7 @@ You supply the key to Terraform using the environment variable
`GOOGLE_CLOUD_KEYFILE_JSON`, setting the value to the location of the file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please replace GOOGLE_CLOUD_KEYFILE_JSON with GOOGLE_APPLICATION_CREDENTIALS on this line as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yeah sure.

megan07
megan07 approved these changes Dec 2, 2019
Copy link
Contributor

@megan07 megan07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I think I got ahead of myself here. I'm not sure this needs to be changed. To clarify how to set credentials you can read more here https://www.terraform.io/docs/providers/google/guides/provider_reference.html#credentials-1. GOOGLE_CLOUD_KEYFILE_JSON is one of the environment variables to use for the recommended Terraform-specific service accounts. GOOGLE_APPLICATION_CREDENTIALS is used as a fallback if a Terraform-specific service account key file is not provided. These credentials are your Google app default credentials.

@pradeepbhadani
Copy link
Contributor

@megan07 - Agree, but most of the places GOOGLE_APPLICATION_CREDENTIALS is being used. Maybe good to have this PR merged to make documentation consistent?

@megan07
Copy link
Contributor

megan07 commented Dec 2, 2019

Hi @pradeepbhadani, thank you for pointing that out! I think the consistency that we want to keep would be with the recommended practice. If GOOGLE_APPLICATION_CREDENTIALS is used elsewhere in the documentation, I think it would be great to change those cases to GOOGLE_CLOUD_KEYFILE_JSON instead.

@draconteus
Copy link
Contributor Author

draconteus commented Dec 3, 2019

Sorry, I think I got ahead of myself here. I'm not sure this needs to be changed. To clarify how to set credentials you can read more here https://www.terraform.io/docs/providers/google/guides/provider_reference.html#credentials-1. GOOGLE_CLOUD_KEYFILE_JSON is one of the environment variables to use for the recommended Terraform-specific service accounts. GOOGLE_APPLICATION_CREDENTIALS is used as a fallback if a Terraform-specific service account key file is not provided. These credentials are your Google app default credentials.

The problem was for me, that I tried to use GOOGLE_CLOUD_KEYFILE_JSON as it was stated in the docs, but does not worked and I get credentials cannot be found error.
I haven't tried the other two env var mentioned in the docs (I'll try it later), unfortunately I missed the mentioned documentation and found the GOOGLE_APPLICATION_CREDENTIALS in Google Cloud docs.

Update:
I just tested the above mentioned env vars:
GOOGLE_CREDENTIALS=./creds.json terraform plan - works fine
GOOGLE_CLOUD_KEYFILE_JSON=./creds.json terraform plan - ends with could not find default credentials error
GCLOUD_KEYFILE_JSON=./creds.json terraform plan - ends with could not find default credentials error

@megan07
Copy link
Contributor

megan07 commented Dec 4, 2019

Hi @draconteus ! Sorry about this, I accidentally merged this instead of another PR I was looking at (too many tabs open). I will have to test this further, as I have GOOGLE_CLOUD_KEYFILE_JSON set in my environment variables and have never seen that error. I will look at this ASAP and let you know what I think the reasoning might be behind your issue. Meanwhile, could you please open a new PR (or issue) so we can track it there?
Sorry again, I appreciate your patience. Thank you!

@ghost
Copy link

ghost commented Mar 28, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants