# get org and billing id based on project
org_id=$(gcloud projects get-ancestors $project_id --format='get(id)' | tail -1)
billing_id=$(gcloud alpha billing projects describe $project_id '--format=value(billingAccountName)' | sed 's/.*\///')
we need a -z check on the billing_id
if [ -z "$billing_id" ]
oot_@cloudshell:~/cloudshell_open/accelerators_accelerateurs-gcp/deployment-templates/Terraform/guardrails/0-bootstrap (gr-bootstrap-sgz)$ ./bootstrap.sh -d sgz -p gr-bootstrap-sgz
seed project id: sgz-seed-project
boostrap project id: gr-bootstrap-sgz
org id: 22179561076
billing id:
Updated property [core/project].
checking roles of current account: root@staging.gcp.zone
iam.serviceAccountTokenCreator
ROLE: roles/iam.serviceAccountTokenCreator role set OK on super admin account
Create in progress for [https://cloudresourcemanager.googleapis.com/v1/projects/sgz-seed-project].
Waiting for [operations/cp.6003059784043367773] to finish...done.
Enabling service [cloudapis.googleapis.com] on project [sgz-seed-project]...
Operation "operations/acat.p2-101190464045-7acd03d2-460b-484d-9bfe-b38f153261f0" finished successfully.
ERROR: (gcloud.beta.billing.projects.link) could not parse resource []
Listed 0 items.
Created service account [tfadmin-sgz].
root_@cloudshell:~/cloudshell_open/accelerators_accelerateurs-gcp/deployment-templates/Terraform/guardrails/0-bootstrap (gr-bootstrap-sgz)$ billing_id=$(gcloud alpha billing projects describe $project_id '--format=value(billingAccountName)' | sed 's/.*\///')
root_@cloudshell:~/cloudshell_open/accelerators_accelerateurs-gcp/deployment-templates/Terraform/guardrails/0-bootstrap (gr-bootstrap-sgz)$ echo $billing_id
An empty value means billing is not enabled on the project yet - and will cause issues later on
There is a billing check on line 69 of bootstrap.sh https://github.com/canada-ca/accelerators_accelerateurs-gcp/blob/main/deployment-templates/Terraform/guardrails/0-bootstrap/bootstrap.sh#L69
An empty value means billing is not enabled on the project yet - and will cause issues later on