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

Validate gcloud auth before checking GCE scope #224

Merged
merged 2 commits into from
Nov 19, 2018

Conversation

fieryorc
Copy link
Contributor

  • When running cloud_sql_proxy in GCE instance that is configured with gcloud, cloud_sql_proxy fails saying:

the default Compute Engine service account is not configured with sufficient permissions to access the Cloud SQL API from this VM. Please create a new VM with Cloud SQL access (scope) enabled under "Identity and API access". Alternatively, create a new "service account key" and specify it using the -credential_file parameter

This happens because the auth check function doesn't check if gcloud auth is available.

Fix: Add additional gcloud check before checking for GCE metadata scopes.

 - When running cloud_sql_proxy in GCE instance that is configured with gcloud, cloud_sql_proxy fails saying:

the default Compute Engine service account is not configured with sufficient permissions to access the Cloud SQL API from this VM. Please create a new VM with Cloud SQL access (scope) enabled under "Identity and API access". Alternatively, create a new "service account key" and specify it using the -credential_file parameter

This happens because the auth check function doesn't check if gcloud auth is available.

Fix: Add additional gcloud check before checking for GCE metadata scopes.
Copy link
Contributor

@hfwang hfwang left a comment

Choose a reason for hiding this comment

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

Overall LGTM, minor nit.

cmd/cloud_sql_proxy/cloud_sql_proxy.go Outdated Show resolved Hide resolved
@hfwang
Copy link
Contributor

hfwang commented Nov 19, 2018

Thanks for doing this!

@hfwang hfwang merged commit 9be52bf into GoogleCloudPlatform:master Nov 19, 2018
yosatak pushed a commit to yosatak/cloud-sql-proxy that referenced this pull request Feb 26, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants