https://pulumi.com logo
Title
c

clean-winter-59829

03/01/2023, 5:56 AM
how do you get the current GCP project of the stack in pulumi?
b

best-summer-38252

03/01/2023, 6:42 AM
this is what Im doing in my particular case
const GCP_PROJECT = pulumi.output(
  gcp.projects.getProject({ filter: `name:${gcpConfig.require("project")}*` }).then((p) => p.projects[0])
);
e

eager-keyboard-30823

03/01/2023, 8:36 AM
gcp.config.project
works for me (typescript)
b

best-summer-38252

03/01/2023, 4:46 PM
ya, thats going to work for me too! thanks.
Aah
gcp.config.project
doesnt give me the project object with properties such the id so I can take back my forehead slap. Still this is an improvement:
gcp.projects.getProject({ filter: `name:${gcp.config.project}*` }).then((p) => p.projects[0])
e

eager-keyboard-30823

03/01/2023, 5:08 PM
@best-summer-38252 You should also be able to use
gcp.organizations.getProject().then((project) => project.id);