I would like to operate in n project, looping the ...
# typescript
v
I would like to operate in n project, looping the code
g
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
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
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
thanks!