https://pulumi.com logo
#typescript
Title
# typescript
v

victorious-helmet-11068

02/05/2020, 4:11 PM
I would like to operate in n project, looping the code
g

green-school-95910

02/05/2020, 4:16 PM
If it was me I would create a ComponentResource for each type of project and define the resources inside of it (possibly and probably in more layers of abstraction) Then compose the various projects like any object, looping what needs many, passing inputs and all of that
You can do what you want quite easily in Pulumi, I prefer to organize as above because it makes sense to me on the dashboard
v

victorious-helmet-11068

02/05/2020, 4:27 PM
ok thanks. But in an eventual foreach loop: there is a variable that can contains the prioject id ? I don’t find it..
mhmhm
I have to try environment variables..
setting CLOUDSDK_CORE_PROJECT in code
g

green-school-95910

02/05/2020, 4:29 PM
You can create one provider for each project
Or you can use the
project
variable in each resource options
I prefer creating new providers with the same credentials as it propagates to child resources
For creating those projects you can use the default provider, passing
gcp:credentials
on the config or use the environment default credentials, either a service account with the environment variable
GOOGLE_APPLICATION_CREDENTIAL
, a user account with
gcloud auth application-default login
or the environment inside gcp
v

victorious-helmet-11068

02/05/2020, 6:05 PM
thanks!