This section will go over creating and initializing a GCP project.
And wait.
A few APIs are necessary to get started. Using the search feature in the blue navigation bar, search for (and enable) the following APIs * Cloud Resource Manager API * Identity and Access Management API * Compute Engine API * Google Cloud SQL API
Go to the menu (☰), and navigate to “IAM & Admin” -> “Quotas”. Increase the following: * Global In-use IP addresses * Set to 50 * Global CPUs * Set to 100 * Regional CPUs (the region you’re deploying in) * Set to 100
- Clone the repository
git clone https://github.com/starkandwayne/codex
- Move to the Google Terraform
cd codex/terraform/google
- Initialize Terraform
terraform init
- Grab credentials from GCP with GCC (the >_ icon in the Cloud Console)
export project_id=$(gcloud config get-value project)
export region=us-east1
export zone=us-east1-d
export service_account_email=terraform@${project_id}.iam.gserviceaccount.com
gcloud config set compute/zone ${zone}
gcloud config set compute/region ${region}
gcloud iam service-accounts create terraform --display-name terraform
gcloud iam service-accounts keys create ~/terraform.key.json \
--iam-account ${service_account_email}
gcloud projects add-iam-policy-binding ${project_id} \
--member serviceAccount:${service_account_email} \
--role roles/owner
- Download
terraform.key.json
using the GCP GCC interface, and place it withinkeys/
asiam.json
- Begin populating
google.tfvars
- Make sure the two prefixes are globally unique, and that they’re all lower-case a-z (no numbers!)
- Generate SSH keys for the bastion host:
ssh-keygen -f keys/gce </dev/null
chmod 0400 keys/*
echo "/keys" >> .gitignore