Skip to content

Commit

Permalink
Merge pull request #132 from Spazzy757/master
Browse files Browse the repository at this point in the history
Added private endpoint option to GKE setup
  • Loading branch information
pst authored Nov 5, 2020
2 parents 37b31e7 + d50de43 commit b002726
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
13 changes: 13 additions & 0 deletions google/_modules/gke/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,17 @@ resource "google_container_cluster" "current" {
start_time = var.daily_maintenance_window_start_time
}
}

private_cluster_config {
enable_private_nodes = var.enable_private_nodes
enable_private_endpoint = false
master_ipv4_cidr_block = var.master_cidr_block
}

dynamic "ip_allocation_policy" {
for_each = var.enable_private_nodes ? toset([1]) : []

content {}
}
}

10 changes: 10 additions & 0 deletions google/_modules/gke/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,13 @@ variable "disable_default_ingress" {
type = bool
description = "Whether to disable the default ingress."
}

variable "enable_private_nodes" {
type = bool
description = "Whether to enable private nodes"
}

variable "master_cidr_block" {
type = string
description = "The IP range for the master network"
}
4 changes: 4 additions & 0 deletions google/cluster/configuration.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,8 @@ locals {
manifest_path = var.manifest_path != null ? var.manifest_path : local.manifest_path_default

disable_default_ingress = lookup(local.cfg, "disable_default_ingress", false)

enable_private_nodes = lookup(local.cfg, "enable_private_nodes", true)
master_cidr_block = lookup(local.cfg, "master_cidr_block", "172.16.0.32/28")
}

3 changes: 3 additions & 0 deletions google/cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,7 @@ module "cluster" {
manifest_path = local.manifest_path

disable_default_ingress = local.disable_default_ingress

enable_private_nodes = local.enable_private_nodes
master_cidr_block = local.master_cidr_block
}

0 comments on commit b002726

Please sign in to comment.