Skip to content

notablehealth/terraform-google-gke-node-pools

Repository files navigation

terraform-google-gke-node-pools

Releases

Terraform Module Registry

Manage independent node pools in a GKE cluster.

Work in Progress - May get redesigned before it's finished

Features

  • Manage any number of node pools

Usage

Basic usage of this module is as follows:

module "example" {
    source = "notablehealth/<module-name>/google"
    # Recommend pinning every module to a specific version
    # version = "x.x.x"

    # Required variables
    cluster_location =
    cluster_name =
    node_pools =
    project_id =
}

Requirements

Name Version
terraform >= 1.5.7
google ~> 5.0
random ~> 3.5

Providers

Name Version
google 5.1.0
random 3.5.1

Modules

No modules.

Resources

Name Type
google_container_node_pool.self resource
random_shuffle.available_zones resource
google_compute_zones.available data source
google_container_cluster.existing data source

Inputs

Name Description Type Default Required
cluster_location Location of the existing GKE cluster string n/a yes
cluster_name Name of the existing GKE cluster to add node pools too string n/a yes
default_auto_repair Default value for auto_repair in node pools bool true no
default_auto_upgrade Default value for auto_upgrade in node pools bool true no
disable_legacy_metadata_endpoints Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. bool true no
node_metadata Specifies how node metadata is exposed to the workload running on the node string "GKE_METADATA" no
node_pools Map of node pool objects
map(object({ # list(map(any))
#auto_upgrade = optional(bool)
autoscaling = optional(bool, true)
autoscaling_min_node_count = optional(number)
autoscaling_max_node_count = optional(number)
autoscaling_location_policy = optional(string)
autoscaling_total_min_node_count = optional(number)
autoscaling_total_max_node_count = optional(number)
initial_node_count = optional(number)
max_pods_per_node = optional(number)
#min_count = optional(number)
node_locations = optional(string, "")
version = optional(string)
management = optional(object({
auto_repair = optional(bool, true)
auto_upgrade = optional(bool, true)
}))
node_config = optional(object({
boot_disk_kms_key = optional(string)
disk_size_gb = optional(number)
disk_type = optional(string)
enable_gcfs = optional(bool, false)
enable_gvnic = optional(bool, false)
image_type = optional(string)
labels = optional(map(string))
local_ssd_count = optional(number)
logging_variant = optional(string)
machine_type = optional(string)
metadata = optional(map(string))
min_cpu_platform = optional(string)
oauth_scopes = optional(list(string))
preemptible = optional(bool)
resource_labels = optional(map(string))
service_account = optional(string)
spot = optional(bool)
tags = optional(list(string))
workload_metadata = optional(string)
guest_accelerator = optional(object({
type = optional(string)
count = optional(number)
gpu_partition_size = optional(number)
}))
linux_node_config = optional(object({
sysctls = optional(map(string))
}))
shielded_instance_config = optional(object({
enable_secure_boot = optional(bool)
enable_integrity_monitoring = optional(bool)
}))
taints = optional(list(object({
key = string
value = string
effect = string
})), [])
}))
#upgrade_strategy = optional(string)
#upgrade_max_surge = optional(number)
#upgrade_max_unavailable = optional(number)
#upgrade_bg_node_pool_soak_duration = optional(string)
#upgrade_bg_standard_rollout_policy_batch_soak_duration = optional(string)
#upgrade_bg_standard_rollout_policy_batch_percentage = optional(number)
#upgrade_bg_standard_rollout_policy_batch_node_count = optional(number)
upgrade_settings = optional(object({
strategy = optional(string)
max_surge = optional(number)
max_unavailable = optional(number)
blue_green_settings = optional(object({
node_pool_soak_duration = optional(string)
standard_rollout_policy = optional(object({
batch_soak_duration = optional(string)
batch_percentage = optional(number)
batch_node_count = optional(number)
}))
}))
}))

}))
n/a yes
node_pools_labels Map of maps containing node labels by node-pool name map(map(any))
{
"all": {
"terraform": true
}
}
no
node_pools_linux_node_configs_sysctls Map of maps containing linux node config sysctls by node-pool name map(map(string))
{
"all": {}
}
no
node_pools_metadata Map of maps containing node metadata by node-pool name map(map(string))
{
"all": {}
}
no
node_pools_oauth_scopes Map of lists containing node oauth scopes by node-pool name map(list(string))
{
"all": [
"https://www.googleapis.com/auth/cloud-platform"
]
}
no
node_pools_resource_labels Map of maps containing resource labels by node-pool name map(map(string))
{
"all": {}
}
no
node_pools_tags Map of lists containing node network tags by node-pool name map(list(string))
{
"all": []
}
no
node_pools_taints Map of lists containing node taints by node-pool name map(list(object({ key = string, value = string, effect = string })))
{
"all": []
}
no
project_id The ID of the project in which the resource belongs. string n/a yes
release_channel The release channel of this cluster. Accepted values are UNSPECIFIED, RAPID, REGULAR and STABLE. Defaults to REGULAR. string "REGULAR" no
timeouts Timeout for cluster operations. map(string) {} no

Outputs

Name Description
cluster_default_node_zones The default zones for node pools in the cluster
instance_group_urls List of GKE generated instance groups
zones Available zones
zones_random Available zones - randomized

Releases

No releases published

Packages

No packages published

Languages