https://github.com/notablehealth/terraform-google-gke-node-pools
Manage independent GKE node pools
https://github.com/notablehealth/terraform-google-gke-node-pools
gcp gke google terraform-module
Last synced: 12 months ago
JSON representation
Manage independent GKE node pools
- Host: GitHub
- URL: https://github.com/notablehealth/terraform-google-gke-node-pools
- Owner: notablehealth
- Created: 2023-10-11T17:38:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-04T00:32:48.000Z (about 2 years ago)
- Last Synced: 2025-04-05T15:24:18.860Z (about 1 year ago)
- Topics: gcp, gke, google, terraform-module
- Language: HCL
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# terraform-google-gke-node-pools
[](https://github.com/notablehealth/terraform-google-gke-node-pools/releases)
[Terraform Module Registry](https://registry.terraform.io/modules/notablehealth/gke-node-pools/google)
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:
```hcl
module "example" {
source = "notablehealth//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](#requirement\_terraform) | >= 1.5.7 |
| [google](#requirement\_google) | ~> 5.0 |
| [random](#requirement\_random) | ~> 3.5 |
## Providers
| Name | Version |
|------|---------|
| [google](#provider\_google) | 5.1.0 |
| [random](#provider\_random) | 3.5.1 |
## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [google_container_node_pool.self](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool) | resource |
| [random_shuffle.available_zones](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/shuffle) | resource |
| [google_compute_zones.available](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/compute_zones) | data source |
| [google_container_cluster.existing](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/container_cluster) | data source |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [cluster\_location](#input\_cluster\_location) | Location of the existing GKE cluster | `string` | n/a | yes |
| [cluster\_name](#input\_cluster\_name) | Name of the existing GKE cluster to add node pools too | `string` | n/a | yes |
| [default\_auto\_repair](#input\_default\_auto\_repair) | Default value for auto\_repair in node pools | `bool` | `true` | no |
| [default\_auto\_upgrade](#input\_default\_auto\_upgrade) | Default value for auto\_upgrade in node pools | `bool` | `true` | no |
| [disable\_legacy\_metadata\_endpoints](#input\_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](#input\_node\_metadata) | Specifies how node metadata is exposed to the workload running on the node | `string` | `"GKE_METADATA"` | no |
| [node\_pools](#input\_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](#input\_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](#input\_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](#input\_node\_pools\_metadata) | Map of maps containing node metadata by node-pool name | `map(map(string))` | {
"all": {}
} | no |
| [node\_pools\_oauth\_scopes](#input\_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](#input\_node\_pools\_resource\_labels) | Map of maps containing resource labels by node-pool name | `map(map(string))` | {
"all": {}
} | no |
| [node\_pools\_tags](#input\_node\_pools\_tags) | Map of lists containing node network tags by node-pool name | `map(list(string))` | {
"all": []
} | no |
| [node\_pools\_taints](#input\_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](#input\_project\_id) | The ID of the project in which the resource belongs. | `string` | n/a | yes |
| [release\_channel](#input\_release\_channel) | The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `REGULAR`. | `string` | `"REGULAR"` | no |
| [timeouts](#input\_timeouts) | Timeout for cluster operations. | `map(string)` | `{}` | no |
## Outputs
| Name | Description |
|------|-------------|
| [cluster\_default\_node\_zones](#output\_cluster\_default\_node\_zones) | The default zones for node pools in the cluster |
| [instance\_group\_urls](#output\_instance\_group\_urls) | List of GKE generated instance groups |
| [zones](#output\_zones) | Available zones |
| [zones\_random](#output\_zones\_random) | Available zones - randomized |