https://pulumi.com logo
Title
p

prehistoric-controller-43830

02/03/2023, 6:34 PM
Hi all, I'm using gcp-typescript , is there a clean way to programmatically obtain the GC projectId? I know about these ugly methods: • get it from .project attribute of random resource in the scope (i don't wan't to create a dummy one just for that) • store it explicitly in the stack config (that's data duplication) • maybe I can access config key like "gcp:project_id", if it's possible, is it even available when I configure project using CLOUDSDK_CORE_PROJECT env? • read CLOUDSDK_CORE_PROJECT env (also, depends on specific usage) In Terraform I had
google_project
datasource that (without arguments) returned the current project. Can I somehow access the default provider config in the code, or otherwise get the current project resource? Thanks!
a

ancient-policeman-24615

02/03/2023, 9:48 PM
The gcp equivalent of the
google_project
is the organization.getProject function.
g

great-sunset-355

02/04/2023, 12:15 PM
pulumi is pretty much Terraform under the hood, for GCP it follows google beta, the only difference is
snake_case
to
camelCase
in TS and interfaces. Almost all problems and solutions in TF transfer to pulumi
p

prehistoric-controller-43830

02/05/2023, 9:11 AM
oh, thanks! I knew it must be hiding somewhere :)