Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion modules/gcp/gke/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,29 @@ resource "google_compute_subnetwork" "cluster_subnet" {
]
}

locals {
ng_formated_zones_list = [for ng in var.node_pools :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also set defaults for these params. Just saw that there weren't any

{
name = ng.name
machine_type = ng.machine_type
disk_size_gb = ng.disk_size_gb
disk_type = ng.disk_type
image_type = ng.image_type
autoscaling = ng.autoscaling
min_count = ng.min_count
max_count = ng.max_count
auto_repair = ng.auto_repair
auto_upgrade = ng.auto_upgrade
preemptible = ng.preemptible
enable_gcfs = ng.enable_gcfs
accelerator_type = ng.accelerator_type
accelerator_count = ng.accelerator_count
node_locations = ng.zones != null ? join(",", ng.zones) : ""
}
]
}


module "gke" {
depends_on = [google_compute_subnetwork.cluster_subnet]
source = "github.com/argonautdev/terraform-google-kubernetes-engine//modules/private-cluster?ref=v21.1.5"
Expand All @@ -56,7 +79,7 @@ module "gke" {
enable_vertical_pod_autoscaling = var.enable_vertical_pod_autoscaling
kubernetes_version = var.kubernetes_version
initial_node_count = var.initial_node_count ##How many instances should be launched in each zone
node_pools = var.node_pools
node_pools = local.ng_formated_zones_list
remove_default_node_pool = var.remove_default_node_pool
cluster_resource_labels = merge(var.default_labels, var.labels)
//kubernetes_version = var.kubernetes_version
Expand Down
4 changes: 3 additions & 1 deletion modules/gcp/gke/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ variable "node_pools" {
enable_gcfs = bool,##Set to true only if image streaming is required.
accelerator_type = optional(string),
accelerator_count = optional(number),
zones = optional(list(string))
}))
description = "List of maps containing node pools"
default = [
Expand All @@ -177,7 +178,8 @@ variable "node_pools" {
image_type = "COS_CONTAINERD"
autoscaling = false
auto_upgrade = false,
enable_gcfs = false
enable_gcfs = false,
zones = ["us-central1-a", "us-central1-b"]
}
]
}
Expand Down