Skip to content

Commit

Permalink
Adding in feature to specify a regional or zonal GKE cluster type (#69)
Browse files Browse the repository at this point in the history
Signed-off-by: gar <[email protected]>
  • Loading branch information
sekka1 authored Mar 5, 2020
1 parent 8249852 commit 40bf5d4
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions tf-environments/gcp/dev/_env_defaults/gcp.tfvars
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
region = "us-central1"
project_name = "managedkube"

# regional cluster with 3 masters use the region with the zone (eg. us-central1). This cost $0.10/hour.
# zonal cluster that has only one master and in one zone. Add the zone to the region. (eg. us-central1-a). There is no GCP charge for this.
google_container_cluster_location = "us-central1-a"
1 change: 1 addition & 0 deletions tf-environments/gcp/dev/nodepools/pool-1/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ terraform {
inputs = {

cluster_name = trimspace(run_cmd("terragrunt", "output", "cluster_name", "--terragrunt-working-dir", "../../gke-cluster"))

node_pool_name = "pool-1"

initial_node_count = "1"
Expand Down
2 changes: 1 addition & 1 deletion tf-modules/gcp/nodepool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ provider "google-beta" {
resource "google_container_node_pool" "node_nodes" {
provider = google-beta
name = var.node_pool_name
location = var.region
location = var.google_container_cluster_location
cluster = var.cluster_name
node_count = var.initial_node_count
autoscaling {
Expand Down
4 changes: 4 additions & 0 deletions tf-modules/gcp/nodepool/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ variable "credentials_file_path" {
description = "A local path to a service account json credentials file."
}

variable "google_container_cluster_location" {
description = "Location of the cluster to make it a regional or zonal cluster"
}

variable "cluster_name" {
default = "dev"
}
Expand Down
2 changes: 1 addition & 1 deletion tf-modules/gcp/private-gke-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ provider "google-beta" {
resource "google_container_cluster" "primary" {
provider = google-beta
name = var.cluster_name
location = var.region
location = var.google_container_cluster_location
node_version = var.gke_version
min_master_version = var.gke_version
network = var.network_name
Expand Down
4 changes: 4 additions & 0 deletions tf-modules/gcp/private-gke-cluster/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ variable "private_subnet_name" {
description = "The name of the private subnet to use"
}

variable "google_container_cluster_location" {
description = "Location of the cluster to make it a regional or zonal cluster"
}

#####################################
#####################################
variable "cluster_name" {
Expand Down

0 comments on commit 40bf5d4

Please sign in to comment.