Deploy OpenShift 3.11 Container Platform on Google Cloud Platform using Terraform

git clone https://github.com/berndonline/openshift-terraform.git
cd ./openshift-terraform/ && git checkout google-dev
cat << EOF > ./credentials.json
{
"type": "service_account",
"project_id": "<--your-project-->",
"private_key_id": "<--your-key-id-->",
"private_key": "-----BEGIN PRIVATE KEY-----

...

}
EOF
...
terraform {
backend "gcs" {
bucket = "<--your-bucket-name-->"
prefix = "openshift-311"
credentials = "credentials.json"
}
}
...
...
variable "gcp_region" {
description = "Google Compute Platform region to launch servers."
default = "europe-west3"
}
variable "gcp_project" {
description = "Google Compute Platform project name."
default = "<--your-project-name-->"
}
variable "gcp_zone" {
type = "string"
default = "europe-west3-a"
description = "The zone to provision into"
}
...
export TF_VAR_email='<-YOUR-CLOUDFLARE-EMAIL-ADDRESS->'
export TF_VAR_token='<-YOUR-CLOUDFLARE-TOKEN->'
export TF_VAR_domain='<-YOUR-CLOUDFLARE-DOMAIN->'
export TF_VAR_htpasswd='<-YOUR-OPENSHIFT-DEMO-USER-HTPASSWD->'
terraform init && terraform apply -auto-approve
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ./helper_scripts/id_rsa -r ./helper_scripts/id_rsa centos@$(terraform output bastion):/home/centos/.ssh/
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ./helper_scripts/id_rsa -r ./inventory/ansible-hosts centos@$(terraform output bastion):/home/centos/ansible-hosts
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ./helper_scripts/id_rsa -l centos $(terraform output bastion) -A "cd /openshift-ansible/ && ansible-playbook ./playbooks/openshift-pre.yml -i ~/ansible-hosts"
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ./helper_scripts/id_rsa -l centos $(terraform output bastion) -A "cd /openshift-ansible/ && ansible-playbook ./playbooks/openshift-install.yml -i ~/ansible-hosts"
terraform destroy -force

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store