From d44bdcf07c533f82ec8623eb393f5ee768c42d06 Mon Sep 17 00:00:00 2001 From: James Blair Date: Wed, 13 Jan 2021 14:34:56 +1300 Subject: [PATCH] Added gcp project creation section. --- 2-configure-gcp-project.sh | 16 ++++++++++++++++ README.org | 13 +++++++++++++ 2 files changed, 29 insertions(+) create mode 100755 2-configure-gcp-project.sh diff --git a/2-configure-gcp-project.sh b/2-configure-gcp-project.sh new file mode 100755 index 0000000..38e5eed --- /dev/null +++ b/2-configure-gcp-project.sh @@ -0,0 +1,16 @@ +#!/bin/bash + + +# Once we have authenticated we can create a project and then create a new virtual machine instance within that project. + +# #+NAME: Create a new google cloud project + +# Create a project id based on date +export gcp_project_id="gitlab-gcp-"$(date +"%Y-%m-%d") + +# Create new project using a random project id +gcloud projects create $gcp_project_id + +# Ensure billing is enabled for the project +export gcp_billing_account=$(gcloud alpha billing accounts list --limit=1 --format='value(name.basename())') +gcloud alpha billing projects link $gcp_project_id --billing-account $gcp_billing_account diff --git a/README.org b/README.org index ba64318..1364a88 100644 --- a/README.org +++ b/README.org @@ -47,3 +47,16 @@ gcloud auth login #+END_SRC Once we have authenticated we can create a project and then create a new virtual machine instance within that project. + +#+NAME: Create a new google cloud project +#+begin_src bash :shebang #!/bin/bash :tangle 2-configure-gcp-project.sh +# Create a project id based on date +export gcp_project_id="gitlab-gcp-"$(date +"%Y-%m-%d") + +# Create new project using a random project id +gcloud projects create $gcp_project_id + +# Ensure billing is enabled for the project +export gcp_billing_account=$(gcloud alpha billing accounts list --limit=1 --format='value(name.basename())') +gcloud alpha billing projects link $gcp_project_id --billing-account $gcp_billing_account +#+end_src