Skip to content

Commit

Permalink
Remove any GCP terraform config relating to the enable_private_cluste…
Browse files Browse the repository at this point in the history
…r variable
  • Loading branch information
sgibson91 committed Jan 29, 2025
1 parent 1537cfc commit f5d8652
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 101 deletions.
26 changes: 0 additions & 26 deletions terraform/gcp/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,32 +70,6 @@ resource "google_container_cluster" "cluster" {
prevent_destroy = true
}

// For private clusters, pass the name of the network and subnetwork created
// by the VPC
network = var.enable_private_cluster ? data.google_compute_network.default_network.name : null
subnetwork = var.enable_private_cluster ? data.google_compute_subnetwork.default_subnetwork.name : null

// Dynamically provision the private cluster config when deploying a
// private cluster
dynamic "private_cluster_config" {
for_each = var.enable_private_cluster ? [1] : []

content {
// Decide if this CIDR block is sensible or not
master_ipv4_cidr_block = "172.16.0.0/28"
enable_private_nodes = true
enable_private_endpoint = false
}
}

// Dynamically provision the IP allocation policy when deploying a
// private cluster. This allows for IP aliasing and makes the cluster
// VPC-native
dynamic "ip_allocation_policy" {
for_each = var.enable_private_cluster ? [1] : []
content {}
}

addons_config {
network_policy_config {
disabled = !var.enable_network_policy
Expand Down
58 changes: 0 additions & 58 deletions terraform/gcp/network.tf

This file was deleted.

2 changes: 1 addition & 1 deletion terraform/gcp/storage.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ resource "google_filestore_instance" "homedirs" {
}

networks {
network = var.enable_private_cluster ? data.google_compute_network.default_network.name : "default"
network = "default"
modes = ["MODE_IPV4"]
}
}
16 changes: 0 additions & 16 deletions terraform/gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -300,22 +300,6 @@ variable "user_buckets" {
EOT
}

variable "enable_private_cluster" {
type = bool
default = false
description = <<-EOT
Deploy the kubernetes cluster into a private subnet
By default, GKE gives each of your nodes a public IP & puts them in a public
subnet. When this variable is set to `true`, the nodes will be in a private subnet
and not have public IPs. A cloud NAT will provide outbound internet access from
these nodes. The kubernetes API will still be exposed publicly, so we can access
it from our laptops & CD.
This is often required by institutional controls banning VMs from having public IPs.
EOT
}

variable "filestores" {
type = map(object({
name_suffix : optional(string, null),
Expand Down

0 comments on commit f5d8652

Please sign in to comment.