Skip to content

Instantly share code, notes, and snippets.

@darkn3rd
Created February 20, 2018 22:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darkn3rd/684a31b48ac0573a26175ac34f1ca7b8 to your computer and use it in GitHub Desktop.
Save darkn3rd/684a31b48ac0573a26175ac34f1ca7b8 to your computer and use it in GitHub Desktop.
Manage GCP Projects 1
export TF_USER=${USER}. # user account, replace if not current user name
export TF_VAR_ORG_ID=$(gcloud organizations list | awk '!/^DISPLAY_NAME/ { print $2 }')
export TF_VAR_BILLING_ACCOUNT=$(gcloud beta billing accounts list | awk '!/^ID/ { print $1 }')
export TF_ADMIN=${TF_USER}-terraform-admin
# Create New Project
gcloud projects create ${TF_ADMIN} \
--organization ${TF_VAR_ORG_ID} \
--set-as-default
# Link Project to Billing Account
gcloud beta billing projects link ${TF_ADMIN} \
--billing-account ${TF_VAR_BILLING_ACCOUNT}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment