I'm probably missing something simple, but I'm run...
# general
b
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
Is that stored in Pulumi Config?
b
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
Isn’t all that just stored in an environment variable?
b
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
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
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
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