diff --git a/modules/gke-cluster-autopilot/README.md b/modules/gke-cluster-autopilot/README.md index 16558d33b..922c1d369 100644 --- a/modules/gke-cluster-autopilot/README.md +++ b/modules/gke-cluster-autopilot/README.md @@ -291,26 +291,26 @@ module "cluster-1" { | name | description | type | required | default | |---|---|:---:|:---:|:---:| -| [location](variables.tf#L184) | Autopilot clusters are always regional. | string | ✓ | | -| [name](variables.tf#L263) | Cluster name. | string | ✓ | | -| [project_id](variables.tf#L296) | Cluster project ID. | string | ✓ | | -| [vpc_config](variables.tf#L312) | VPC-level configuration. | object({…}) | ✓ | | +| [location](variables.tf#L186) | Autopilot clusters are always regional. | string | ✓ | | +| [name](variables.tf#L265) | Cluster name. | string | ✓ | | +| [project_id](variables.tf#L298) | Cluster project ID. | string | ✓ | | +| [vpc_config](variables.tf#L314) | VPC-level configuration. | object({…}) | ✓ | | | [access_config](variables.tf#L17) | Control plane endpoint and nodes access configurations. | object({…}) | | {} | | [backup_configs](variables.tf#L49) | Configuration for Backup for GKE. | object({…}) | | {} | | [deletion_protection](variables.tf#L71) | Whether or not to allow Terraform to destroy the cluster. Unless this field is set to false in Terraform state, a terraform destroy or terraform apply that would delete the cluster will fail. | bool | | true | | [description](variables.tf#L78) | Cluster description. | string | | null | | [enable_addons](variables.tf#L84) | Addons enabled in the cluster (true means enabled). | object({…}) | | {} | -| [enable_features](variables.tf#L98) | Enable cluster-level features. Certain features allow configuration. | object({…}) | | {} | -| [fleet_project](variables.tf#L166) | The name of the fleet host project where this cluster will be registered. | string | | null | -| [issue_client_certificate](variables.tf#L172) | Enable issuing client certificate. | bool | | false | -| [labels](variables.tf#L178) | Cluster resource labels. | map(string) | | null | -| [logging_config](variables.tf#L189) | Logging configuration. | object({…}) | | {} | -| [maintenance_config](variables.tf#L200) | Maintenance window configuration. | object({…}) | | {…} | -| [min_master_version](variables.tf#L223) | Minimum version of the master, defaults to the version of the most recent official release. | string | | null | -| [monitoring_config](variables.tf#L229) | Monitoring configuration. System metrics collection cannot be disabled. Control plane metrics are optional. Kube state metrics are optional. Google Cloud Managed Service for Prometheus is enabled by default. | object({…}) | | {} | -| [node_config](variables.tf#L268) | Configuration for nodes and nodepools. | object({…}) | | {} | -| [node_locations](variables.tf#L289) | Zones in which the cluster's nodes are located. | list(string) | | [] | -| [release_channel](variables.tf#L301) | Release channel for GKE upgrades. Clusters created in the Autopilot mode must use a release channel. Choose between \"RAPID\", \"REGULAR\", and \"STABLE\". | string | | "REGULAR" | +| [enable_features](variables.tf#L98) | Enable cluster-level features. Certain features allow configuration. | object({…}) | | {} | +| [fleet_project](variables.tf#L168) | The name of the fleet host project where this cluster will be registered. | string | | null | +| [issue_client_certificate](variables.tf#L174) | Enable issuing client certificate. | bool | | false | +| [labels](variables.tf#L180) | Cluster resource labels. | map(string) | | null | +| [logging_config](variables.tf#L191) | Logging configuration. | object({…}) | | {} | +| [maintenance_config](variables.tf#L202) | Maintenance window configuration. | object({…}) | | {…} | +| [min_master_version](variables.tf#L225) | Minimum version of the master, defaults to the version of the most recent official release. | string | | null | +| [monitoring_config](variables.tf#L231) | Monitoring configuration. System metrics collection cannot be disabled. Control plane metrics are optional. Kube state metrics are optional. Google Cloud Managed Service for Prometheus is enabled by default. | object({…}) | | {} | +| [node_config](variables.tf#L270) | Configuration for nodes and nodepools. | object({…}) | | {} | +| [node_locations](variables.tf#L291) | Zones in which the cluster's nodes are located. | list(string) | | [] | +| [release_channel](variables.tf#L303) | Release channel for GKE upgrades. Clusters created in the Autopilot mode must use a release channel. Choose between \"RAPID\", \"REGULAR\", and \"STABLE\". | string | | "REGULAR" | ## Outputs diff --git a/modules/gke-cluster-autopilot/main.tf b/modules/gke-cluster-autopilot/main.tf index 2879478fb..a4baea076 100644 --- a/modules/gke-cluster-autopilot/main.tf +++ b/modules/gke-cluster-autopilot/main.tf @@ -23,17 +23,19 @@ resource "google_container_cluster" "cluster" { node_locations = ( length(var.node_locations) == 0 ? null : var.node_locations ) - min_master_version = var.min_master_version - network = var.vpc_config.network - subnetwork = var.vpc_config.subnetwork - resource_labels = var.labels - enable_multi_networking = var.enable_features.multi_networking - enable_l4_ilb_subsetting = var.enable_features.l4_ilb_subsetting - enable_tpu = var.enable_features.tpu - initial_node_count = 1 - enable_autopilot = true - allow_net_admin = var.enable_features.allow_net_admin - deletion_protection = var.deletion_protection + min_master_version = var.min_master_version + network = var.vpc_config.network + subnetwork = var.vpc_config.subnetwork + resource_labels = var.labels + enable_multi_networking = var.enable_features.multi_networking + enable_l4_ilb_subsetting = var.enable_features.l4_ilb_subsetting + enable_tpu = var.enable_features.tpu + initial_node_count = 1 + enable_autopilot = true + allow_net_admin = var.enable_features.allow_net_admin + deletion_protection = var.deletion_protection + enable_cilium_clusterwide_network_policy = var.enable_features.cilium_clusterwide_network_policy + enable_fqdn_network_policy = var.enable_features.fqdn_network_policy addons_config { # HTTP Load Balancing is required to be enabled in Autopilot clusters diff --git a/modules/gke-cluster-autopilot/variables.tf b/modules/gke-cluster-autopilot/variables.tf index d4dfaa0bc..015d8eb71 100644 --- a/modules/gke-cluster-autopilot/variables.tf +++ b/modules/gke-cluster-autopilot/variables.tf @@ -98,9 +98,10 @@ variable "enable_addons" { variable "enable_features" { description = "Enable cluster-level features. Certain features allow configuration." type = object({ - beta_apis = optional(list(string)) - binary_authorization = optional(bool, false) - cost_management = optional(bool, true) + beta_apis = optional(list(string)) + binary_authorization = optional(bool, false) + cilium_clusterwide_network_policy = optional(bool, false) + cost_management = optional(bool, true) dns = optional(object({ additive_vpc_scope_dns_domain = optional(string) provider = optional(string) @@ -112,6 +113,7 @@ variable "enable_features" { state = string key_name = string })) + fqdn_network_policy = optional(bool, false) gateway_api = optional(bool, false) groups_for_rbac = optional(string) l4_ilb_subsetting = optional(bool, false)