From 8da69302cef7384f1f91f4f6a69f7bd062a697d1 Mon Sep 17 00:00:00 2001 From: Luigi Bitonti Date: Thu, 14 Dec 2023 10:08:30 +0100 Subject: [PATCH] Changed variable position --- modules/gke-cluster-autopilot/README.md | 31 ++++++++++---------- modules/gke-cluster-autopilot/main.tf | 2 +- modules/gke-cluster-autopilot/variables.tf | 9 ++---- modules/gke-cluster-standard/README.md | 33 +++++++++++----------- modules/gke-cluster-standard/main.tf | 2 +- modules/gke-cluster-standard/variables.tf | 11 ++------ 6 files changed, 38 insertions(+), 50 deletions(-) diff --git a/modules/gke-cluster-autopilot/README.md b/modules/gke-cluster-autopilot/README.md index c7857755de..39b8d34d9a 100644 --- a/modules/gke-cluster-autopilot/README.md +++ b/modules/gke-cluster-autopilot/README.md @@ -206,26 +206,25 @@ module "cluster-1" { | name | description | type | required | default | |---|---|:---:|:---:|:---:| -| [location](variables.tf#L110) | Autopilot clusters are always regional. | string | ✓ | | -| [name](variables.tf#L187) | Cluster name. | string | ✓ | | -| [project_id](variables.tf#L223) | Cluster project ID. | string | ✓ | | -| [vpc_config](variables.tf#L245) | VPC-level configuration. | object({…}) | ✓ | | +| [location](variables.tf#L111) | Autopilot clusters are always regional. | string | ✓ | | +| [name](variables.tf#L188) | Cluster name. | string | ✓ | | +| [project_id](variables.tf#L224) | Cluster project ID. | string | ✓ | | +| [vpc_config](variables.tf#L240) | VPC-level configuration. | object({…}) | ✓ | | | [backup_configs](variables.tf#L17) | Configuration for Backup for GKE. | object({…}) | | {} | | [deletion_protection](variables.tf#L37) | 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#L44) | Cluster description. | string | | null | | [enable_addons](variables.tf#L50) | Addons enabled in the cluster (true means enabled). | object({…}) | | {} | -| [enable_features](variables.tf#L64) | Enable cluster-level features. Certain features allow configuration. | object({…}) | | {} | -| [issue_client_certificate](variables.tf#L98) | Enable issuing client certificate. | bool | | false | -| [labels](variables.tf#L104) | Cluster resource labels. | map(string) | | null | -| [logging_config](variables.tf#L115) | Logging configuration. | object({…}) | | {} | -| [maintenance_config](variables.tf#L126) | Maintenance window configuration. | object({…}) | | {…} | -| [min_master_version](variables.tf#L149) | Minimum version of the master, defaults to the version of the most recent official release. | string | | null | -| [monitoring_config](variables.tf#L155) | 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#L192) | Configuration for nodes and nodepools. | object({…}) | | {} | -| [node_locations](variables.tf#L202) | Zones in which the cluster's nodes are located. | list(string) | | [] | -| [private_cluster_config](variables.tf#L209) | Private cluster configuration. | object({…}) | | null | -| [release_channel](variables.tf#L228) | 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_external_ips](variables.tf#L239) | Controls whether external ips specified by a service will be allowed. | bool | | true | +| [enable_features](variables.tf#L64) | Enable cluster-level features. Certain features allow configuration. | object({…}) | | {} | +| [issue_client_certificate](variables.tf#L99) | Enable issuing client certificate. | bool | | false | +| [labels](variables.tf#L105) | Cluster resource labels. | map(string) | | null | +| [logging_config](variables.tf#L116) | Logging configuration. | object({…}) | | {} | +| [maintenance_config](variables.tf#L127) | Maintenance window configuration. | object({…}) | | {…} | +| [min_master_version](variables.tf#L150) | Minimum version of the master, defaults to the version of the most recent official release. | string | | null | +| [monitoring_config](variables.tf#L156) | 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#L193) | Configuration for nodes and nodepools. | object({…}) | | {} | +| [node_locations](variables.tf#L203) | Zones in which the cluster's nodes are located. | list(string) | | [] | +| [private_cluster_config](variables.tf#L210) | Private cluster configuration. | object({…}) | | null | +| [release_channel](variables.tf#L229) | 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 626c52250e..8383c32268 100644 --- a/modules/gke-cluster-autopilot/main.tf +++ b/modules/gke-cluster-autopilot/main.tf @@ -59,7 +59,7 @@ resource "google_container_cluster" "cluster" { } service_external_ips_config { - enabled = var.service_external_ips + enabled = var.enable_features.service_external_ips } dynamic "authenticator_groups_config" { diff --git a/modules/gke-cluster-autopilot/variables.tf b/modules/gke-cluster-autopilot/variables.tf index c014356fb8..97c8348b73 100644 --- a/modules/gke-cluster-autopilot/variables.tf +++ b/modules/gke-cluster-autopilot/variables.tf @@ -86,7 +86,8 @@ variable "enable_features" { enable_network_egress_metering = optional(bool) enable_resource_consumption_metering = optional(bool) })) - tpu = optional(bool, false) + service_external_ips = optional(bool, true) + tpu = optional(bool, false) upgrade_notifications = optional(object({ topic_id = optional(string) })) @@ -236,12 +237,6 @@ variable "release_channel" { } } -variable "service_external_ips" { - description = "Controls whether external ips specified by a service will be allowed." - type = bool - default = true -} - variable "vpc_config" { description = "VPC-level configuration." type = object({ diff --git a/modules/gke-cluster-standard/README.md b/modules/gke-cluster-standard/README.md index a08cd098b7..ceff50a87a 100644 --- a/modules/gke-cluster-standard/README.md +++ b/modules/gke-cluster-standard/README.md @@ -310,28 +310,27 @@ module "cluster-1" { | name | description | type | required | default | |---|---|:---:|:---:|:---:| -| [location](variables.tf#L211) | Cluster zone or region. | string | ✓ | | -| [name](variables.tf#L322) | Cluster name. | string | ✓ | | -| [project_id](variables.tf#L358) | Cluster project id. | string | ✓ | | -| [vpc_config](variables.tf#L375) | VPC-level configuration. | object({…}) | ✓ | | +| [location](variables.tf#L212) | Cluster zone or region. | string | ✓ | | +| [name](variables.tf#L323) | Cluster name. | string | ✓ | | +| [project_id](variables.tf#L359) | Cluster project id. | string | ✓ | | +| [vpc_config](variables.tf#L370) | VPC-level configuration. | object({…}) | ✓ | | | [backup_configs](variables.tf#L17) | Configuration for Backup for GKE. | object({…}) | | {} | | [cluster_autoscaling](variables.tf#L38) | Enable and configure limits for Node Auto-Provisioning with Cluster Autoscaler. | object({…}) | | null | | [deletion_protection](variables.tf#L115) | 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#L122) | Cluster description. | string | | null | | [enable_addons](variables.tf#L128) | Addons enabled in the cluster (true means enabled). | object({…}) | | {…} | -| [enable_features](variables.tf#L152) | Enable cluster-level features. Certain features allow configuration. | object({…}) | | {…} | -| [issue_client_certificate](variables.tf#L199) | Enable issuing client certificate. | bool | | false | -| [labels](variables.tf#L205) | Cluster resource labels. | map(string) | | null | -| [logging_config](variables.tf#L216) | Logging configuration. | object({…}) | | {} | -| [maintenance_config](variables.tf#L237) | Maintenance window configuration. | object({…}) | | {…} | -| [max_pods_per_node](variables.tf#L260) | Maximum number of pods per node in this cluster. | number | | 110 | -| [min_master_version](variables.tf#L266) | Minimum version of the master, defaults to the version of the most recent official release. | string | | null | -| [monitoring_config](variables.tf#L272) | Monitoring configuration. Google Cloud Managed Service for Prometheus is enabled by default. | object({…}) | | {} | -| [node_config](variables.tf#L327) | Node-level configuration. | object({…}) | | {} | -| [node_locations](variables.tf#L337) | Zones in which the cluster's nodes are located. | list(string) | | [] | -| [private_cluster_config](variables.tf#L344) | Private cluster configuration. | object({…}) | | null | -| [release_channel](variables.tf#L363) | Release channel for GKE upgrades. | string | | null | -| [service_external_ips](variables.tf#L369) | Controls whether external ips specified by a service will be allowed. | bool | | true | +| [enable_features](variables.tf#L152) | Enable cluster-level features. Certain features allow configuration. | object({…}) | | {…} | +| [issue_client_certificate](variables.tf#L200) | Enable issuing client certificate. | bool | | false | +| [labels](variables.tf#L206) | Cluster resource labels. | map(string) | | null | +| [logging_config](variables.tf#L217) | Logging configuration. | object({…}) | | {} | +| [maintenance_config](variables.tf#L238) | Maintenance window configuration. | object({…}) | | {…} | +| [max_pods_per_node](variables.tf#L261) | Maximum number of pods per node in this cluster. | number | | 110 | +| [min_master_version](variables.tf#L267) | Minimum version of the master, defaults to the version of the most recent official release. | string | | null | +| [monitoring_config](variables.tf#L273) | Monitoring configuration. Google Cloud Managed Service for Prometheus is enabled by default. | object({…}) | | {} | +| [node_config](variables.tf#L328) | Node-level configuration. | object({…}) | | {} | +| [node_locations](variables.tf#L338) | Zones in which the cluster's nodes are located. | list(string) | | [] | +| [private_cluster_config](variables.tf#L345) | Private cluster configuration. | object({…}) | | null | +| [release_channel](variables.tf#L364) | Release channel for GKE upgrades. | string | | null | ## Outputs diff --git a/modules/gke-cluster-standard/main.tf b/modules/gke-cluster-standard/main.tf index 763ec49b63..4a943aa167 100644 --- a/modules/gke-cluster-standard/main.tf +++ b/modules/gke-cluster-standard/main.tf @@ -111,7 +111,7 @@ resource "google_container_cluster" "cluster" { } } service_external_ips_config { - enabled = var.service_external_ips + enabled = var.enable_features.service_external_ips } dynamic "authenticator_groups_config" { for_each = var.enable_features.groups_for_rbac != null ? [""] : [] diff --git a/modules/gke-cluster-standard/variables.tf b/modules/gke-cluster-standard/variables.tf index c9358ddcb3..1f95c0c897 100644 --- a/modules/gke-cluster-standard/variables.tf +++ b/modules/gke-cluster-standard/variables.tf @@ -177,8 +177,9 @@ variable "enable_features" { enable_network_egress_metering = optional(bool) enable_resource_consumption_metering = optional(bool) })) - shielded_nodes = optional(bool, false) - tpu = optional(bool, false) + service_external_ips = optional(bool, true) + shielded_nodes = optional(bool, false) + tpu = optional(bool, false) upgrade_notifications = optional(object({ topic_id = optional(string) })) @@ -366,12 +367,6 @@ variable "release_channel" { default = null } -variable "service_external_ips" { - description = "Controls whether external ips specified by a service will be allowed." - type = bool - default = true -} - variable "vpc_config" { description = "VPC-level configuration." type = object({