Hi, I want to create a persistent disk but it seem...
# google-cloud
Hi, I want to create a persistent disk but it seems the project parameter is required instead of using the currently active project. How can I get the currently set project ID?
gcloud config get-value project
returns the correct value but I can't figure out how to get it in pulumi.
I tried that. Returns
. 😞
Using Python, so I tried
Are you using the credentials from default environment or setting on your stack config?
Just my default environment.
I think, not sure, pulumi gcp provider is supposed to recognize the project from environment I don't know the API in Python, but there is a
on JS that you could use to set the "gcp:project" on the go
Of course, that would make it explicit that you are using the project from your environment and ignore what was already on the stack, which is not a good thing most of the time
Ok, thanks. Yes, it gets it correctly when I explicitly set it in the env. Not sure where gcloud gets its configuration from but seems pulumi is not using the same. I'll see that I set the env vars correctly. Thanks for your help.
Are you using user credentials of a service account?
No, just the standard
gcloud login
with my user.
Gcloud has a state saved in a file with all your configs, it looks for environment variables first and then this file Try getting your project and credentials using
Copy code
from google.auth import default
project, credentials = default()
See if the project and credentials are set correctly gcloud has a mess of a chain of fallbacks
Thanks. I might actually just get the output of the gcloud command and set project, region etc with that.