From aa801090810ba119a2786d214495b3f39e19da28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Sauv=C3=A8re?= Date: Wed, 24 May 2023 12:19:43 +0200 Subject: [PATCH] allow to configure `stack_type` in the GKE modules (#1395) Co-authored-by: Ludovico Magnocavallo --- modules/gke-cluster-autopilot/README.md | 2 +- modules/gke-cluster-autopilot/main.tf | 2 ++ modules/gke-cluster-autopilot/variables.tf | 1 + modules/gke-cluster-standard/README.md | 2 +- modules/gke-cluster-standard/main.tf | 2 ++ modules/gke-cluster-standard/variables.tf | 1 + 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/gke-cluster-autopilot/README.md b/modules/gke-cluster-autopilot/README.md index 3c0d64f5..f0144fea 100644 --- a/modules/gke-cluster-autopilot/README.md +++ b/modules/gke-cluster-autopilot/README.md @@ -99,7 +99,7 @@ module "cluster-1" { | [location](variables.tf#L110) | Autopilot cluster are always regional. | string | ✓ | | | [name](variables.tf#L145) | Cluster name. | string | ✓ | | | [project_id](variables.tf#L171) | Cluster project id. | string | ✓ | | -| [vpc_config](variables.tf#L194) | VPC-level configuration. | object({…}) | ✓ | | +| [vpc_config](variables.tf#L194) | VPC-level configuration. | object({…}) | ✓ | | | [backup_configs](variables.tf#L17) | Configuration for Backup for GKE. | object({…}) | | {} | | [description](variables.tf#L37) | Cluster description. | string | | null | | [enable_addons](variables.tf#L43) | Addons enabled in the cluster (true means enabled). | object({…}) | | {…} | diff --git a/modules/gke-cluster-autopilot/main.tf b/modules/gke-cluster-autopilot/main.tf index 693370c8..4b18f3ad 100644 --- a/modules/gke-cluster-autopilot/main.tf +++ b/modules/gke-cluster-autopilot/main.tf @@ -100,6 +100,7 @@ resource "google_container_cluster" "cluster" { content { cluster_ipv4_cidr_block = var.vpc_config.secondary_range_blocks.pods services_ipv4_cidr_block = var.vpc_config.secondary_range_blocks.services + stack_type = try(var.vpc_config.stack_type, null) } } @@ -108,6 +109,7 @@ resource "google_container_cluster" "cluster" { content { cluster_secondary_range_name = var.vpc_config.secondary_range_names.pods services_secondary_range_name = var.vpc_config.secondary_range_names.services + stack_type = try(var.vpc_config.stack_type, null) } } diff --git a/modules/gke-cluster-autopilot/variables.tf b/modules/gke-cluster-autopilot/variables.tf index 75755963..5965cb64 100644 --- a/modules/gke-cluster-autopilot/variables.tf +++ b/modules/gke-cluster-autopilot/variables.tf @@ -206,6 +206,7 @@ variable "vpc_config" { services = string }), { pods = "pods", services = "services" }) master_authorized_ranges = optional(map(string)) + stack_type = optional(string) }) nullable = false } diff --git a/modules/gke-cluster-standard/README.md b/modules/gke-cluster-standard/README.md index bcee3320..972d5904 100644 --- a/modules/gke-cluster-standard/README.md +++ b/modules/gke-cluster-standard/README.md @@ -134,7 +134,7 @@ module "cluster-1" { | [location](variables.tf#L137) | Cluster zone or region. | string | ✓ | | | [name](variables.tf#L194) | Cluster name. | string | ✓ | | | [project_id](variables.tf#L220) | Cluster project id. | string | ✓ | | -| [vpc_config](variables.tf#L237) | VPC-level configuration. | object({…}) | ✓ | | +| [vpc_config](variables.tf#L237) | VPC-level configuration. | object({…}) | ✓ | | | [backup_configs](variables.tf#L17) | Configuration for Backup for GKE. | object({…}) | | {} | | [cluster_autoscaling](variables.tf#L37) | Enable and configure limits for Node Auto-Provisioning with Cluster Autoscaler. | object({…}) | | null | | [description](variables.tf#L58) | Cluster description. | string | | null | diff --git a/modules/gke-cluster-standard/main.tf b/modules/gke-cluster-standard/main.tf index dedd705b..9c051835 100644 --- a/modules/gke-cluster-standard/main.tf +++ b/modules/gke-cluster-standard/main.tf @@ -162,6 +162,7 @@ resource "google_container_cluster" "cluster" { content { cluster_ipv4_cidr_block = var.vpc_config.secondary_range_blocks.pods services_ipv4_cidr_block = var.vpc_config.secondary_range_blocks.services + stack_type = try(var.vpc_config.stack_type, null) } } dynamic "ip_allocation_policy" { @@ -169,6 +170,7 @@ resource "google_container_cluster" "cluster" { content { cluster_secondary_range_name = var.vpc_config.secondary_range_names.pods services_secondary_range_name = var.vpc_config.secondary_range_names.services + stack_type = try(var.vpc_config.stack_type, null) } } diff --git a/modules/gke-cluster-standard/variables.tf b/modules/gke-cluster-standard/variables.tf index 814d89a1..cced3129 100644 --- a/modules/gke-cluster-standard/variables.tf +++ b/modules/gke-cluster-standard/variables.tf @@ -249,6 +249,7 @@ variable "vpc_config" { services = string }), { pods = "pods", services = "services" }) master_authorized_ranges = optional(map(string)) + stack_type = optional(string) }) nullable = false }