Huge thanks to @pivotal-cf for https://github.com/pivotal-cf/terraforming-gcp. I have taken their work and upgraded it in accordance with current PKS documentation for GCP.
Your system needs the gcloud cli, as well as terraform:
brew update
brew install Caskroom/cask/google-cloud-sdk
brew install terraformCopy the stub content below into a file called terraform.tfvars and put it in the root of this project.
These vars will be used when you run terraform apply.
You should fill in the stub values with the correct content.
env_prefix = "my-pks-eu"
project = "your-gcp-project"
region = "europe-west1"
zones = ["europe-west1-b", "europe-west1-c", "europe-west1-d"]
service_account_key = <<SERVICE_ACCOUNT_KEY
{
"type": "service_account",
"project_id": "your-gcp-project",
"private_key_id": "another-gcp-private-key",
"private_key": "-----BEGIN PRIVATE KEY-----another gcp private key-----END PRIVATE KEY-----\n",
"client_email": "something@example.com",
"client_id": "11111111111111",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/"
}
SERVICE_ACCOUNT_KEY
nat_machine_type = "n1-standard-4"
opsman_image_url = "https://storage.googleapis.com/ops-manager-eu/pcf-gcp-2.0-build.249.tar.gz"
opsman_machine_type = "n1-standard-2"- env_prefix: (required) An arbitrary unique name for namespacing resources. Max 23 characters.
- project: (required) ID for your GCP project.
- region: (required) Region in which to create resources (e.g. europe-west1)
- zones: (required) Zones in which to create resources. Must be within the given region. Currently you must specify exactly 3 Zones for this terraform configuration to work. (e.g. [us-central1-a, us-central1-b, us-central1-c])
- opsman_image_url (required) Source URL of the Ops Manager image you want to boot.
- service_account_key: (required) Contents of your service account key file generated using the
gcloud iam service-accounts keys createcommand. - nat_machine_type: (default: n1-standard-4) NAT machine type
- opsman_machine_type: (default: n1-standard-2) Ops Manager machine type
Note: please make sure you have created the terraform.tfvars file above as mentioned.
terraform init
terraform plan -out=plan
terraform apply planterraform destroy