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

Allow raw JSON to be passed into GOOGLE_APPLICATION_CREDENTIALS env variable #323

Closed
mholyak opened this issue Oct 28, 2019 · 10 comments · Fixed by #1433
Closed

Allow raw JSON to be passed into GOOGLE_APPLICATION_CREDENTIALS env variable #323

mholyak opened this issue Oct 28, 2019 · 10 comments · Fixed by #1433
Assignees
Labels
priority: p0 Highest priority. Critical issue. P0 implies highest priority. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@mholyak
Copy link

mholyak commented Oct 28, 2019

... or into new env variable.

Usecase is using service in bitbucket pipelines:

image

@kurtisvg kurtisvg added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Oct 28, 2019
@kurtisvg
Copy link
Contributor

While this isn't the exact useless you described, you can use the -token flag to pass in credentials to the proxy when it starts (which could rely on a env var).

@Carrotman42
Copy link
Contributor

Carrotman42 commented Oct 28, 2019 via email

@Carrotman42
Copy link
Contributor

Carrotman42 commented Oct 28, 2019 via email

@mholyak
Copy link
Author

mholyak commented Oct 28, 2019

Is there a way to store a file to disk using the bitbucket configuration?

Sure, and I'm using it now to run cloud-proxy in background:

image

But, if I want to have it as stand-alone service (similar to docker-compose items) I need to define it in special separate section and only env variables are available there...

@gregmsanderson
Copy link

+1 for this, seems like a great idea to be able to pass the json content. Since many faas/paas seem to support using secrets in key => value form. So then the content of the json could be stored once, as a secret, and then that file then never needs to be kept in a file system.

@ryboe
Copy link

ryboe commented Apr 13, 2020

+1 for this. Requiring that the file be present on the filesystem makes cloud_sql_proxy difficult to use with terraform. This code search of GitHub shows that the only way anybody has figured out how to deploy cloud_sql_proxy with terraform is to use k8s volume mounts.

I think the scarcity of terraform+cloud_sql_proxy usage on GitHub points to a serious usability problem. It is, of course, up to you whether you want to support terraform. If you do, allowing us to set the entire service account key as an env var would make cloud_sql_proxy much easier to use. Thanks for keeping this issue open and considering this feature.

@enocom
Copy link
Member

enocom commented Sep 14, 2022

We don’t control GOOGLE_APPLICATION_CREDENTIALS and so can’t change how it works. However, there is a CredentialsFromJSON method that we could in theory expose as a CLI flag. That said I don’t understand the use case here and why using a credential file isn’t a reasonable option.

@ryboe
Copy link

ryboe commented Sep 15, 2022

The use case is: it's easier to pass the credentials into a container as an env var instead of mounting them as a volume. Look at all the templating hoops I had to jump through to deploy Cloud SQL Proxy with Terraform. Also, lots of container environments are restricted (e.g. CI/CD) and don't let you mount volumes. But just about every container environment lets you set env vars.

@enocom enocom added priority: p0 Highest priority. Critical issue. P0 implies highest priority. and removed priority: p3 Desirable enhancement or fix. May not be included in next release. labels Sep 15, 2022
@enocom
Copy link
Member

enocom commented Sep 15, 2022

Thanks @ryboe. That makes perfect sense. This is such an easy and quick change, I'll pull it into my queue.

@enocom
Copy link
Member

enocom commented Sep 24, 2022

This is on main now and will be available in the next preview release of v2 (preview 2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p0 Highest priority. Critical issue. P0 implies highest priority. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants