Skip to content

Automation Code (TF) for deploy and manage OpenShift Dedicated in GCP within Pre-Existing VPCs OR in Private mode

Notifications You must be signed in to change notification settings

rh-mobb/terraform-google-osd

Repository files navigation

OpenShift Dedicated for GCP in Pre-Existing VPCs & in Private Mode

Automation Code for deploy and manage OpenShift Dedicated in GCP in Pre-Existing VPCs & Private Mode

Useful notes before you start

  • Follow the guide here to set up your GCP service account

  • Export the location of your json file using: export TF_VAR_gcp_sa_file_loc=$PATH_TO_JSON_FILE

  • Note: if your ssh key is not ~/.ssh/id_rsa.pub, set this using:

export TF_VAR_bastion_key_loc=$PATH_TO_PUBLIC_KEY

OSD in GCP in Pre-Existing VPCs / Subnets (ideally use the terraform below)

  • Copy and modify the tfvars file in order to custom to your scenario
cp -pr terraform.tfvars.example terraform.tfvars

OSD in GCP building everything from scratch (automation yay!)

  • Deploy everything using terraform and ocm:

Ensure you have the following installed:

  • ocm binary, logged in

  • jq

  • gcloud binary, logged in

  • Ensure you have the following exported:

export TF_VAR_clustername=$YOUR_CLUSTER_NAME
export TF_VAR_gcp_sa_file_loc=$PATH_TO_YOUR_SA_JSON

Then:

make all

This will:

  1. Build your VPCs based on the config in configuration/tfvars
  2. Connect to your ocm console and create a new cluster using the variables from terraform

You should then be good to go!

Or if you want to do it manually:

export ENVIRONMENT="lab"
export TF_BACKEND_CONF="configuration/backend"
export TF_VARIABLES="configuration/tfvars"
export TF_VAR_clustername=$YOUR_CLUSTER_NAME

terraform init -backend-config="$TF_BACKEND_CONF/$ENVIRONMENT.conf"
terraform plan -var-file="$TF_VARIABLES/terraform.tfvars" -out "output/tf.$ENVIRONMENT.plan"
terraform apply output/tf.$ENVIRONMENT.plan

OSD in GCP in Private Mode

NOTE: this will be deploying also the Bastion host that will be used for connect to the OSD private cluster.

  • Setup to true these two variables, in your terraform.tfvars.
enable_osd_gcp_bastion = true
osd_gcp_private = true
  • Deploy the network infrastructure in GCP needed for deploy the OSD cluster
make all
  • or if you want to do it manually:
export ENVIRONMENT="lab"
export TF_BACKEND_CONF="configuration/backend"
export TF_VARIABLES="configuration/tfvars"

terraform init -backend-config="$TF_BACKEND_CONF/$ENVIRONMENT.conf"
terraform plan -var-file="$TF_VARIABLES/terraform.tfvars" -out "output/tf.$ENVIRONMENT.plan"
terraform apply output/tf.$ENVIRONMENT.plan

Auto cleanup

Export the following:

export TF_VAR_clustername=$YOUR_CLUSTER_NAME

Then:

make destroy

About

Automation Code (TF) for deploy and manage OpenShift Dedicated in GCP within Pre-Existing VPCs OR in Private mode

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •