4.3 - Terraform variables

# Google project id
variable "gcp_project_id" {}
# Region
variable "gcp_region" {}
# Zone
variable "gcp_zone" {}
# VPC Name
variable "vpc_name" {}
# Name of private subnet
variable "private_subnet_name" {}
# Private IP CIDR range
variable "private_ip_cidr_range" {}
# Private IP CIRD range for the Kubernetes Pod's
variable "private_ip_pod_cidr_range" {}
# Name of the firewall to allow internal traffic
variable "firewall_allow_internal_name" {}
# Allows range of interal IP Addresses e.g. ["10.240.0.0/24", "10.200.0.0/16"]
variable "firewall_allow_internal_range" { type = list(string) }
# Name of the firewall to allow external traffic
variable "firewall_allow_external_name" {}
# Path to the Google cloud project credential (this is the json credentials file)
variable "gcp_credential" {}
# Type of machine to use for the Kubernetes Controllers and Worker nodes
variable "gce_machine_type" {}
# Type of OS to use
variable "gce_disk_image" {}
# Associate the SSH key to authenticate with the Compute instances
variable "gce_ssh_key" {}
# Associate the SSH username to authenticate with the Compute instances
variable "gce_ssh_key_username" {}
# Number of Kubernetes Worker nodes to provision
variable "nodes" { type = number }
# Number of Kubernetes Controllers to provision
variable "controllers" { type = number }
# Size of the disk to use on the Compute instance
variable "gce_disk_size" { type = number }
# Allows range of IP Address to access the HTTP check on the loadbalancer
# https://cloud.google.com/kubernetes-engine/docs/concepts/firewall-rules
variable "firewall_health_check_allow_range" {type=list(string)}

Terraform .tfvars

gcp_project_id                = "<google-cloud-project-name>"
gcp_region                    = "us-central1"
gcp_zone                      = "us-central1-a"
vpc_name                      = "kubernetes-thw"
private_subnet_name           = "kubernetes-subnet"
private_ip_cidr_range         = "10.240.0.0/24"
private_ip_pod_cidr_range     = "10.200.$worker.0/24"
firewall_allow_internal_name  = "firewall-allow-internal"
firewall_allow_internal_range = ["10.240.0.0/24", "10.200.0.0/16"]
firewall_allow_external_name  = "firewall-allow-external"
gcp_credential                = "<path to json credential>"
gce_machine_type              = "f1-micro"
gce_disk_image                = "ubuntu-os-cloud/ubuntu-1604-xenial-v20210429"
gce_ssh_key                   = "<path to SSH public key>"
gce_ssh_key_username          = "<SSH username to use>"

gce_disk_size = 100

# kubernetes instance group sizes
nodes       = 3
controllers = 3

# http health vars
firewall_health_check_allow_range = ["209.85.152.0/22", "209.85.204.0/22", "35.191.0.0/16"]

Last updated on 17 Aug 2021
Published on 17 Aug 2021