diff --git a/modules/gke-cluster-autopilot/README.md b/modules/gke-cluster-autopilot/README.md
index 2ad1cf4b07..c4176a1df8 100644
--- a/modules/gke-cluster-autopilot/README.md
+++ b/modules/gke-cluster-autopilot/README.md
@@ -122,7 +122,7 @@ module "cluster-1" {
| [location](variables.tf#L110) | Autopilot cluster are always regional. | string
| ✓ | |
| [name](variables.tf#L155) | Cluster name. | string
| ✓ | |
| [project_id](variables.tf#L181) | Cluster project id. | string
| ✓ | |
-| [vpc_config](variables.tf#L204) | VPC-level configuration. | object({…})
| ✓ | |
+| [vpc_config](variables.tf#L209) | 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({…})
| | {…}
|
@@ -134,9 +134,9 @@ module "cluster-1" {
| [min_master_version](variables.tf#L149) | Minimum version of the master, defaults to the version of the most recent official release. | string
| | null
|
| [node_locations](variables.tf#L160) | Zones in which the cluster's nodes are located. | list(string)
| | []
|
| [private_cluster_config](variables.tf#L167) | Private cluster configuration. | object({…})
| | null
|
-| [release_channel](variables.tf#L186) | Release channel for GKE upgrades. | string
| | null
|
-| [service_account](variables.tf#L192) | The Google Cloud Platform Service Account to be used by the node VMs created by GKE Autopilot. | string
| | null
|
-| [tags](variables.tf#L198) | Network tags applied to nodes. | list(string)
| | null
|
+| [release_channel](variables.tf#L186) | Release channel for GKE upgrades. Clusters created in the Autopilot mode must use a release channel. Choose between \"RAPID\", \"REGULAR\", and \"STABLE\". | string
| | "REGULAR"
|
+| [service_account](variables.tf#L197) | The Google Cloud Platform Service Account to be used by the node VMs created by GKE Autopilot. | string
| | null
|
+| [tags](variables.tf#L203) | Network tags applied to nodes. | list(string)
| | null
|
## Outputs
diff --git a/modules/gke-cluster-autopilot/main.tf b/modules/gke-cluster-autopilot/main.tf
index d5826b8591..7ae4d04490 100644
--- a/modules/gke-cluster-autopilot/main.tf
+++ b/modules/gke-cluster-autopilot/main.tf
@@ -238,11 +238,8 @@ resource "google_container_cluster" "cluster" {
}
}
- dynamic "release_channel" {
- for_each = var.release_channel != null ? [""] : []
- content {
- channel = var.release_channel
- }
+ release_channel {
+ channel = var.release_channel
}
dynamic "resource_usage_export_config" {
diff --git a/modules/gke-cluster-autopilot/variables.tf b/modules/gke-cluster-autopilot/variables.tf
index c4aa1f93e8..9a30b5bf3e 100644
--- a/modules/gke-cluster-autopilot/variables.tf
+++ b/modules/gke-cluster-autopilot/variables.tf
@@ -184,9 +184,14 @@ variable "project_id" {
}
variable "release_channel" {
- description = "Release channel for GKE upgrades."
+ description = "Release channel for GKE upgrades. Clusters created in the Autopilot mode must use a release channel. Choose between \"RAPID\", \"REGULAR\", and \"STABLE\"."
type = string
- default = null
+ default = "REGULAR"
+ nullable = false
+ validation {
+ condition = contains(["RAPID", "REGULAR", "STABLE"], var.release_channel)
+ error_message = "Must be one of: RAPID, REGULAR, STABLE."
+ }
}
variable "service_account" {