https://pulumi.com logo
#general
Title
# general
b

billowy-garage-68819

03/25/2019, 3:22 PM
I'm probably missing something simple, but I'm running a GCP project and I need to get the value of gcp:project, is there a simple way of getting it without redefining it?
b

broad-football-5123

03/25/2019, 3:49 PM
Is that stored in Pulumi Config?
b

billowy-garage-68819

03/25/2019, 3:56 PM
It is as gcp:project, adjacent to gcp:region, gcp:zone, and gcp:credentials
when I try to access it via config.get/require it's outside of the project scope
i.e. where my config settings are module:var when I call for gcp:project it attempts to lookup modulegcpproject
b

broad-football-5123

03/25/2019, 3:57 PM
Isn’t all that just stored in an environment variable?
b

billowy-garage-68819

03/25/2019, 3:58 PM
not that I'm aware of, the gcloud tool reads it out of config with an environment overwrite I believe
pulumi stack create prompts for those values just fyi, and in my case I work with multiple projects so the configured for the stack needs to be authoritative
b

broad-football-5123

03/25/2019, 3:59 PM
I might be setup differently. I have a
GOOGLE_CREDENTIALS
env var. And that’s a json string.
Have you tried to retrieve it with the config library?
b

billowy-garage-68819

03/25/2019, 4:00 PM
I have, and as mentioned it's scoped wrong
so the config is gcp:project
when I use config it attempts to read modulegcpproject
i.e. clustergcpproject which doesn't exist
w

white-balloon-205

03/25/2019, 4:33 PM
The easiest way is:
Copy code
gcp.config.project
That reads the resolved value of the configuration setting. You can also read the config setting directly via:
Copy code
const config = new pulumi.Config("gcp");
config.get("project");
👍 1
2 Views