https://pulumi.com logo
#google-cloud
Title
# google-cloud
a

average-plastic-1653

09/06/2023, 4:04 PM
I am creating single tenant GCP projects using the organizations.Project in Python. Is there a recommended way to wait for the Project creation to be completed and then move onto creating other infrastructure assets? Thanks!
Copy code
project_name = f"new-project-{client_codename}"
project = organizations.Project(project_name,
                                name=project_name,
                                billing_account="XXXXX-YYYYY-ZZZZZ", 
                                org_id="1234567890", 
                                project_id=project_name)
s

salmon-account-74572

09/06/2023, 4:08 PM
I would imagine if you take a dependency on the project when creating other infrastructure assets (i.e., use
project_name
or
project_id
or similar as an input when creating the other assets) then Pulumi should handle the dependencies correctly. Are you doing that now and it’s not working as expected?
a

average-plastic-1653

09/06/2023, 4:39 PM
Thanks that fixed it @salmon-account-74572, updated the bucket creation code from:
Copy code
bucket1 = storage.Bucket(f"bucket-{client_codename}", location="us-east1", project=project_id)
to:
Copy code
bucket1 = storage.Bucket(f"bucket-{client_codename}", location="us-east1", project=project.project_id)
s

salmon-account-74572

09/06/2023, 5:11 PM
Awesome, glad we could help!
a

average-plastic-1653

09/06/2023, 5:19 PM
Yes, thanks for the prompt response. appreciate it. I am happy to be able to use Python as opposed to YAML 😉
s

salmon-account-74572

09/06/2023, 5:20 PM
Feel free to spread the word about Pulumi!