feat: add gcp_public_cidrs_access_enabled to gke-cluster-{autopilot,standard} (#2993)
This commit is contained in:
@@ -8,6 +8,7 @@ This module offers a way to create and manage Google Kubernetes Engine (GKE) [Au
|
||||
- [Logging configuration](#logging-configuration)
|
||||
- [Monitoring configuration](#monitoring-configuration)
|
||||
- [Backup for GKE](#backup-for-gke)
|
||||
- [Allowing access from Google Cloud services](#allowing-access-from-google-cloud-services)
|
||||
- [Variables](#variables)
|
||||
- [Outputs](#outputs)
|
||||
<!-- END TOC -->
|
||||
@@ -200,30 +201,63 @@ module "cluster-1" {
|
||||
}
|
||||
# tftest modules=1 resources=2 inventory=backup.yaml
|
||||
```
|
||||
|
||||
### Allowing access from Google Cloud services
|
||||
|
||||
To allow access to your cluster from Google Cloud services (like Cloud Shell, Cloud Build, etc.) without needing to manually specify all Google Cloud IP ranges, you can use the `gcp_public_cidrs_access_enabled` parameter:
|
||||
|
||||
```hcl
|
||||
module "cluster-1" {
|
||||
source = "./fabric/modules/gke-cluster-autopilot"
|
||||
project_id = "myproject"
|
||||
name = "cluster-1"
|
||||
location = "europe-west1"
|
||||
access_config = {
|
||||
ip_access = {
|
||||
gcp_public_cidrs_access_enabled = true
|
||||
authorized_ranges = {
|
||||
internal-vms = "10.0.0.0/8"
|
||||
}
|
||||
}
|
||||
}
|
||||
vpc_config = {
|
||||
network = var.vpc.self_link
|
||||
subnetwork = var.subnet.self_link
|
||||
secondary_range_names = {
|
||||
pods = "pods"
|
||||
services = "services"
|
||||
}
|
||||
}
|
||||
labels = {
|
||||
environment = "dev"
|
||||
}
|
||||
}
|
||||
# tftest modules=1 resources=1 inventory=access-google.yaml
|
||||
```
|
||||
<!-- BEGIN TFDOC -->
|
||||
## Variables
|
||||
|
||||
| name | description | type | required | default |
|
||||
|---|---|:---:|:---:|:---:|
|
||||
| [location](variables.tf#L144) | Autopilot clusters are always regional. | <code>string</code> | ✓ | |
|
||||
| [name](variables.tf#L223) | Cluster name. | <code>string</code> | ✓ | |
|
||||
| [project_id](variables.tf#L254) | Cluster project ID. | <code>string</code> | ✓ | |
|
||||
| [vpc_config](variables.tf#L270) | VPC-level configuration. | <code title="object({ disable_default_snat = optional(bool) network = string subnetwork = string secondary_range_blocks = optional(object({ pods = string services = string })) secondary_range_names = optional(object({ pods = optional(string) services = optional(string) })) additional_ranges = optional(list(string)) stack_type = optional(string) })">object({…})</code> | ✓ | |
|
||||
| [access_config](variables.tf#L17) | Control plane endpoint and nodes access configurations. | <code title="object({ dns_access = optional(bool, true) ip_access = optional(object({ authorized_ranges = optional(map(string), {}) disable_public_endpoint = optional(bool, true) private_endpoint_config = optional(object({ endpoint_subnetwork = optional(string) global_access = optional(bool, true) }), {}) }), {}) private_nodes = optional(bool, true) })">object({…})</code> | | <code>{}</code> |
|
||||
| [backup_configs](variables.tf#L42) | Configuration for Backup for GKE. | <code title="object({ enable_backup_agent = optional(bool, false) backup_plans = optional(map(object({ encryption_key = optional(string) include_secrets = optional(bool, true) include_volume_data = optional(bool, true) labels = optional(map(string)) namespaces = optional(list(string)) region = string schedule = string retention_policy_days = optional(string) retention_policy_lock = optional(bool, false) retention_policy_delete_lock_days = optional(string) })), {}) })">object({…})</code> | | <code>{}</code> |
|
||||
| [deletion_protection](variables.tf#L63) | 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. | <code>bool</code> | | <code>true</code> |
|
||||
| [description](variables.tf#L70) | Cluster description. | <code>string</code> | | <code>null</code> |
|
||||
| [enable_addons](variables.tf#L76) | Addons enabled in the cluster (true means enabled). | <code title="object({ cloudrun = optional(bool, false) config_connector = optional(bool, false) istio = optional(object({ enable_tls = bool })) kalm = optional(bool, false) })">object({…})</code> | | <code>{}</code> |
|
||||
| [enable_features](variables.tf#L90) | Enable cluster-level features. Certain features allow configuration. | <code title="object({ beta_apis = optional(list(string)) binary_authorization = optional(bool, false) cost_management = optional(bool, true) dns = optional(object({ provider = optional(string) scope = optional(string) domain = optional(string) })) database_encryption = optional(object({ state = string key_name = string })) gateway_api = optional(bool, false) groups_for_rbac = optional(string) l4_ilb_subsetting = optional(bool, false) mesh_certificates = optional(bool) pod_security_policy = optional(bool, false) secret_manager_config = optional(bool) security_posture_config = optional(object({ mode = string vulnerability_mode = string })) allow_net_admin = optional(bool, false) resource_usage_export = optional(object({ dataset = string enable_network_egress_metering = optional(bool) enable_resource_consumption_metering = optional(bool) })) service_external_ips = optional(bool, true) tpu = optional(bool, false) upgrade_notifications = optional(object({ topic_id = optional(string) })) vertical_pod_autoscaling = optional(bool, false) enterprise_cluster = optional(bool) })">object({…})</code> | | <code>{}</code> |
|
||||
| [issue_client_certificate](variables.tf#L132) | Enable issuing client certificate. | <code>bool</code> | | <code>false</code> |
|
||||
| [labels](variables.tf#L138) | Cluster resource labels. | <code>map(string)</code> | | <code>null</code> |
|
||||
| [logging_config](variables.tf#L149) | Logging configuration. | <code title="object({ enable_api_server_logs = optional(bool, false) enable_scheduler_logs = optional(bool, false) enable_controller_manager_logs = optional(bool, false) })">object({…})</code> | | <code>{}</code> |
|
||||
| [maintenance_config](variables.tf#L160) | Maintenance window configuration. | <code title="object({ daily_window_start_time = optional(string) recurring_window = optional(object({ start_time = string end_time = string recurrence = string })) maintenance_exclusions = optional(list(object({ name = string start_time = string end_time = string scope = optional(string) }))) })">object({…})</code> | | <code title="{ daily_window_start_time = "03:00" recurring_window = null maintenance_exclusion = [] }">{…}</code> |
|
||||
| [min_master_version](variables.tf#L183) | Minimum version of the master, defaults to the version of the most recent official release. | <code>string</code> | | <code>null</code> |
|
||||
| [monitoring_config](variables.tf#L189) | 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. | <code title="object({ enable_api_server_metrics = optional(bool, false) enable_controller_manager_metrics = optional(bool, false) enable_scheduler_metrics = optional(bool, false) enable_daemonset_metrics = optional(bool, false) enable_deployment_metrics = optional(bool, false) enable_hpa_metrics = optional(bool, false) enable_pod_metrics = optional(bool, false) enable_statefulset_metrics = optional(bool, false) enable_storage_metrics = optional(bool, false) enable_cadvisor_metrics = optional(bool, false) enable_managed_prometheus = optional(bool, true) })">object({…})</code> | | <code>{}</code> |
|
||||
| [node_config](variables.tf#L228) | Configuration for nodes and nodepools. | <code title="object({ boot_disk_kms_key = optional(string) service_account = optional(string) tags = optional(list(string)) workload_metadata_config_mode = optional(string) })">object({…})</code> | | <code>{}</code> |
|
||||
| [node_locations](variables.tf#L247) | Zones in which the cluster's nodes are located. | <code>list(string)</code> | | <code>[]</code> |
|
||||
| [release_channel](variables.tf#L259) | Release channel for GKE upgrades. Clusters created in the Autopilot mode must use a release channel. Choose between \"RAPID\", \"REGULAR\", and \"STABLE\". | <code>string</code> | | <code>"REGULAR"</code> |
|
||||
| [location](variables.tf#L145) | Autopilot clusters are always regional. | <code>string</code> | ✓ | |
|
||||
| [name](variables.tf#L224) | Cluster name. | <code>string</code> | ✓ | |
|
||||
| [project_id](variables.tf#L255) | Cluster project ID. | <code>string</code> | ✓ | |
|
||||
| [vpc_config](variables.tf#L271) | VPC-level configuration. | <code title="object({ disable_default_snat = optional(bool) network = string subnetwork = string secondary_range_blocks = optional(object({ pods = string services = string })) secondary_range_names = optional(object({ pods = optional(string) services = optional(string) })) additional_ranges = optional(list(string)) stack_type = optional(string) })">object({…})</code> | ✓ | |
|
||||
| [access_config](variables.tf#L17) | Control plane endpoint and nodes access configurations. | <code title="object({ dns_access = optional(bool, true) ip_access = optional(object({ authorized_ranges = optional(map(string), {}) disable_public_endpoint = optional(bool, true) gcp_public_cidrs_access_enabled = optional(bool, true) private_endpoint_config = optional(object({ endpoint_subnetwork = optional(string) global_access = optional(bool, true) }), {}) }), {}) private_nodes = optional(bool, true) })">object({…})</code> | | <code>{}</code> |
|
||||
| [backup_configs](variables.tf#L43) | Configuration for Backup for GKE. | <code title="object({ enable_backup_agent = optional(bool, false) backup_plans = optional(map(object({ encryption_key = optional(string) include_secrets = optional(bool, true) include_volume_data = optional(bool, true) labels = optional(map(string)) namespaces = optional(list(string)) region = string schedule = string retention_policy_days = optional(string) retention_policy_lock = optional(bool, false) retention_policy_delete_lock_days = optional(string) })), {}) })">object({…})</code> | | <code>{}</code> |
|
||||
| [deletion_protection](variables.tf#L64) | 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. | <code>bool</code> | | <code>true</code> |
|
||||
| [description](variables.tf#L71) | Cluster description. | <code>string</code> | | <code>null</code> |
|
||||
| [enable_addons](variables.tf#L77) | Addons enabled in the cluster (true means enabled). | <code title="object({ cloudrun = optional(bool, false) config_connector = optional(bool, false) istio = optional(object({ enable_tls = bool })) kalm = optional(bool, false) })">object({…})</code> | | <code>{}</code> |
|
||||
| [enable_features](variables.tf#L91) | Enable cluster-level features. Certain features allow configuration. | <code title="object({ beta_apis = optional(list(string)) binary_authorization = optional(bool, false) cost_management = optional(bool, true) dns = optional(object({ provider = optional(string) scope = optional(string) domain = optional(string) })) database_encryption = optional(object({ state = string key_name = string })) gateway_api = optional(bool, false) groups_for_rbac = optional(string) l4_ilb_subsetting = optional(bool, false) mesh_certificates = optional(bool) pod_security_policy = optional(bool, false) secret_manager_config = optional(bool) security_posture_config = optional(object({ mode = string vulnerability_mode = string })) allow_net_admin = optional(bool, false) resource_usage_export = optional(object({ dataset = string enable_network_egress_metering = optional(bool) enable_resource_consumption_metering = optional(bool) })) service_external_ips = optional(bool, true) tpu = optional(bool, false) upgrade_notifications = optional(object({ topic_id = optional(string) })) vertical_pod_autoscaling = optional(bool, false) enterprise_cluster = optional(bool) })">object({…})</code> | | <code>{}</code> |
|
||||
| [issue_client_certificate](variables.tf#L133) | Enable issuing client certificate. | <code>bool</code> | | <code>false</code> |
|
||||
| [labels](variables.tf#L139) | Cluster resource labels. | <code>map(string)</code> | | <code>null</code> |
|
||||
| [logging_config](variables.tf#L150) | Logging configuration. | <code title="object({ enable_api_server_logs = optional(bool, false) enable_scheduler_logs = optional(bool, false) enable_controller_manager_logs = optional(bool, false) })">object({…})</code> | | <code>{}</code> |
|
||||
| [maintenance_config](variables.tf#L161) | Maintenance window configuration. | <code title="object({ daily_window_start_time = optional(string) recurring_window = optional(object({ start_time = string end_time = string recurrence = string })) maintenance_exclusions = optional(list(object({ name = string start_time = string end_time = string scope = optional(string) }))) })">object({…})</code> | | <code title="{ daily_window_start_time = "03:00" recurring_window = null maintenance_exclusion = [] }">{…}</code> |
|
||||
| [min_master_version](variables.tf#L184) | Minimum version of the master, defaults to the version of the most recent official release. | <code>string</code> | | <code>null</code> |
|
||||
| [monitoring_config](variables.tf#L190) | 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. | <code title="object({ enable_api_server_metrics = optional(bool, false) enable_controller_manager_metrics = optional(bool, false) enable_scheduler_metrics = optional(bool, false) enable_daemonset_metrics = optional(bool, false) enable_deployment_metrics = optional(bool, false) enable_hpa_metrics = optional(bool, false) enable_pod_metrics = optional(bool, false) enable_statefulset_metrics = optional(bool, false) enable_storage_metrics = optional(bool, false) enable_cadvisor_metrics = optional(bool, false) enable_managed_prometheus = optional(bool, true) })">object({…})</code> | | <code>{}</code> |
|
||||
| [node_config](variables.tf#L229) | Configuration for nodes and nodepools. | <code title="object({ boot_disk_kms_key = optional(string) service_account = optional(string) tags = optional(list(string)) workload_metadata_config_mode = optional(string) })">object({…})</code> | | <code>{}</code> |
|
||||
| [node_locations](variables.tf#L248) | Zones in which the cluster's nodes are located. | <code>list(string)</code> | | <code>[]</code> |
|
||||
| [release_channel](variables.tf#L260) | Release channel for GKE upgrades. Clusters created in the Autopilot mode must use a release channel. Choose between \"RAPID\", \"REGULAR\", and \"STABLE\". | <code>string</code> | | <code>"REGULAR"</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
||||
@@ -208,10 +208,15 @@ resource "google_container_cluster" "cluster" {
|
||||
}
|
||||
}
|
||||
dynamic "master_authorized_networks_config" {
|
||||
for_each = try(var.access_config.ip_access.authorized_ranges, null) != null ? [""] : []
|
||||
for_each = (
|
||||
try(var.access_config.ip_access.authorized_ranges, null) != null ||
|
||||
try(var.access_config.ip_access.gcp_public_cidrs_access_enabled, null) != null
|
||||
) ? [""] : []
|
||||
content {
|
||||
gcp_public_cidrs_access_enabled = try(var.access_config.ip_access.gcp_public_cidrs_access_enabled, null)
|
||||
|
||||
dynamic "cidr_blocks" {
|
||||
for_each = var.access_config.ip_access.authorized_ranges
|
||||
for_each = try(var.access_config.ip_access.authorized_ranges, {})
|
||||
iterator = range
|
||||
content {
|
||||
cidr_block = range.value
|
||||
|
||||
@@ -19,8 +19,9 @@ variable "access_config" {
|
||||
type = object({
|
||||
dns_access = optional(bool, true)
|
||||
ip_access = optional(object({
|
||||
authorized_ranges = optional(map(string), {})
|
||||
disable_public_endpoint = optional(bool, true)
|
||||
authorized_ranges = optional(map(string), {})
|
||||
disable_public_endpoint = optional(bool, true)
|
||||
gcp_public_cidrs_access_enabled = optional(bool, true)
|
||||
private_endpoint_config = optional(object({
|
||||
endpoint_subnetwork = optional(string)
|
||||
global_access = optional(bool, true)
|
||||
|
||||
@@ -9,6 +9,7 @@ This module offers a way to create and manage Google Kubernetes Engine (GKE) [St
|
||||
- [Cluster access configurations](#cluster-access-configurations)
|
||||
- [Private cluster with DNS endpoint enabled](#private-cluster-with-dns-endpoint-enabled)
|
||||
- [Public cluster](#public-cluster)
|
||||
- [Allowing access from Google Cloud services](#allowing-access-from-google-cloud-services)
|
||||
- [Regional cluster](#regional-cluster)
|
||||
- [Enable Dataplane V2](#enable-dataplane-v2)
|
||||
- [Managing GKE logs](#managing-gke-logs)
|
||||
@@ -104,6 +105,43 @@ module "cluster-1" {
|
||||
# tftest modules=1 resources=1 inventory=access-public.yaml
|
||||
```
|
||||
|
||||
### Allowing access from Google Cloud services
|
||||
|
||||
To allow access to your cluster from Google Cloud services (like Cloud Shell, Cloud Build, etc.) without needing to manually specify all Google Cloud IP ranges, you can use the `gcp_public_cidrs_access_enabled` parameter:
|
||||
|
||||
```hcl
|
||||
module "cluster-1" {
|
||||
source = "./fabric/modules/gke-cluster-standard"
|
||||
project_id = "myproject"
|
||||
name = "cluster-1"
|
||||
location = "europe-west1-b"
|
||||
access_config = {
|
||||
dns_access = false
|
||||
gcp_public_cidrs_access_enabled = true
|
||||
ip_access = {
|
||||
authorized_ranges = {
|
||||
internal-vms = "10.0.0.0/8"
|
||||
}
|
||||
disable_public_endpoint = false
|
||||
}
|
||||
private_nodes = false
|
||||
}
|
||||
vpc_config = {
|
||||
network = var.vpc.self_link
|
||||
subnetwork = var.subnet.self_link
|
||||
secondary_range_names = {
|
||||
pods = "pods"
|
||||
services = "services"
|
||||
}
|
||||
}
|
||||
max_pods_per_node = 32
|
||||
labels = {
|
||||
environment = "dev"
|
||||
}
|
||||
}
|
||||
# tftest modules=1 resources=1 inventory=access-google.yaml
|
||||
```
|
||||
|
||||
## Regional cluster
|
||||
|
||||
Regional clusters are created by setting `location` to a GCP region and then configuring `node_locations`, as shown in the example below.
|
||||
@@ -240,7 +278,7 @@ module "cluster-1" {
|
||||
enable_storage_metrics = true
|
||||
# Kube state metrics collection requires Google Cloud Managed Service for Prometheus,
|
||||
# which is enabled by default.
|
||||
# enable_managed_prometheus = true
|
||||
# enable_managed_prometheus = true
|
||||
}
|
||||
}
|
||||
# tftest modules=1 resources=1 inventory=monitoring-config-kube-state.yaml
|
||||
@@ -428,28 +466,28 @@ module "cluster-1" {
|
||||
|
||||
| name | description | type | required | default |
|
||||
|---|---|:---:|:---:|:---:|
|
||||
| [location](variables.tf#L263) | Cluster zone or region. | <code>string</code> | ✓ | |
|
||||
| [name](variables.tf#L378) | Cluster name. | <code>string</code> | ✓ | |
|
||||
| [project_id](variables.tf#L411) | Cluster project id. | <code>string</code> | ✓ | |
|
||||
| [vpc_config](variables.tf#L422) | VPC-level configuration. | <code title="object({ disable_default_snat = optional(bool) network = string subnetwork = string secondary_range_blocks = optional(object({ pods = string services = string })) secondary_range_names = optional(object({ pods = optional(string) services = optional(string) })) additional_ranges = optional(list(string)) stack_type = optional(string) })">object({…})</code> | ✓ | |
|
||||
| [access_config](variables.tf#L17) | Control plane endpoint and nodes access configurations. | <code title="object({ dns_access = optional(bool, true) ip_access = optional(object({ authorized_ranges = optional(map(string), {}) disable_public_endpoint = optional(bool, true) private_endpoint_config = optional(object({ endpoint_subnetwork = optional(string) global_access = optional(bool, true) }), {}) }), {}) private_nodes = optional(bool, true) })">object({…})</code> | | <code>{}</code> |
|
||||
| [backup_configs](variables.tf#L42) | Configuration for Backup for GKE. | <code title="object({ enable_backup_agent = optional(bool, false) backup_plans = optional(map(object({ region = string applications = optional(map(list(string))) encryption_key = optional(string) include_secrets = optional(bool, true) include_volume_data = optional(bool, true) labels = optional(map(string)) namespaces = optional(list(string)) schedule = optional(string) retention_policy_days = optional(number) retention_policy_lock = optional(bool, false) retention_policy_delete_lock_days = optional(number) })), {}) })">object({…})</code> | | <code>{}</code> |
|
||||
| [cluster_autoscaling](variables.tf#L64) | Enable and configure limits for Node Auto-Provisioning with Cluster Autoscaler. | <code title="object({ enabled = optional(bool, true) autoscaling_profile = optional(string, "BALANCED") auto_provisioning_defaults = optional(object({ boot_disk_kms_key = optional(string) disk_size = optional(number) disk_type = optional(string, "pd-standard") image_type = optional(string) oauth_scopes = optional(list(string)) service_account = optional(string) management = optional(object({ auto_repair = optional(bool, true) auto_upgrade = optional(bool, true) })) shielded_instance_config = optional(object({ integrity_monitoring = optional(bool, true) secure_boot = optional(bool, false) })) upgrade_settings = optional(object({ blue_green = optional(object({ node_pool_soak_duration = optional(string) standard_rollout_policy = optional(object({ batch_percentage = optional(number) batch_node_count = optional(number) batch_soak_duration = optional(string) })) })) surge = optional(object({ max = optional(number) unavailable = optional(number) })) })) })) cpu_limits = optional(object({ min = optional(number, 0) max = number })) mem_limits = optional(object({ min = optional(number, 0) max = number })) accelerator_resources = optional(list(object({ resource_type = string min = optional(number, 0) max = number }))) })">object({…})</code> | | <code>null</code> |
|
||||
| [default_nodepool](variables.tf#L143) | Enable default nodepool. | <code title="object({ remove_pool = optional(bool, true) initial_node_count = optional(number, 1) })">object({…})</code> | | <code>{}</code> |
|
||||
| [deletion_protection](variables.tf#L161) | 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. | <code>bool</code> | | <code>true</code> |
|
||||
| [description](variables.tf#L168) | Cluster description. | <code>string</code> | | <code>null</code> |
|
||||
| [enable_addons](variables.tf#L174) | Addons enabled in the cluster (true means enabled). | <code title="object({ cloudrun = optional(bool, false) config_connector = optional(bool, false) dns_cache = optional(bool, true) gce_persistent_disk_csi_driver = optional(bool, true) gcp_filestore_csi_driver = optional(bool, true) gcs_fuse_csi_driver = optional(bool, true) horizontal_pod_autoscaling = optional(bool, true) http_load_balancing = optional(bool, true) istio = optional(object({ enable_tls = bool })) kalm = optional(bool, false) network_policy = optional(bool, false) stateful_ha = optional(bool, false) })">object({…})</code> | | <code>{}</code> |
|
||||
| [enable_features](variables.tf#L196) | Enable cluster-level features. Certain features allow configuration. | <code title="object({ 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({ provider = optional(string) scope = optional(string) domain = optional(string) })) database_encryption = optional(object({ state = string key_name = string })) dataplane_v2 = optional(bool, true) fqdn_network_policy = optional(bool, true) gateway_api = optional(bool, false) groups_for_rbac = optional(string) image_streaming = optional(bool, false) intranode_visibility = optional(bool, false) l4_ilb_subsetting = optional(bool, false) mesh_certificates = optional(bool) pod_security_policy = optional(bool, false) secret_manager_config = optional(bool) security_posture_config = optional(object({ mode = string vulnerability_mode = string })) resource_usage_export = optional(object({ dataset = string enable_network_egress_metering = optional(bool) enable_resource_consumption_metering = optional(bool) })) service_external_ips = optional(bool, true) shielded_nodes = optional(bool, false) tpu = optional(bool, false) upgrade_notifications = optional(object({ topic_id = optional(string) })) vertical_pod_autoscaling = optional(bool, false) workload_identity = optional(bool, true) enterprise_cluster = optional(bool) })">object({…})</code> | | <code>{}</code> |
|
||||
| [issue_client_certificate](variables.tf#L250) | Enable issuing client certificate. | <code>bool</code> | | <code>false</code> |
|
||||
| [labels](variables.tf#L256) | Cluster resource labels. | <code>map(string)</code> | | <code>{}</code> |
|
||||
| [logging_config](variables.tf#L268) | Logging configuration. | <code title="object({ enable_system_logs = optional(bool, true) enable_workloads_logs = optional(bool, false) enable_api_server_logs = optional(bool, false) enable_scheduler_logs = optional(bool, false) enable_controller_manager_logs = optional(bool, false) })">object({…})</code> | | <code>{}</code> |
|
||||
| [maintenance_config](variables.tf#L289) | Maintenance window configuration. | <code title="object({ daily_window_start_time = optional(string) recurring_window = optional(object({ start_time = string end_time = string recurrence = string })) maintenance_exclusions = optional(list(object({ name = string start_time = string end_time = string scope = optional(string) }))) })">object({…})</code> | | <code title="{ daily_window_start_time = "03:00" recurring_window = null maintenance_exclusion = [] }">{…}</code> |
|
||||
| [max_pods_per_node](variables.tf#L312) | Maximum number of pods per node in this cluster. | <code>number</code> | | <code>110</code> |
|
||||
| [min_master_version](variables.tf#L318) | Minimum version of the master, defaults to the version of the most recent official release. | <code>string</code> | | <code>null</code> |
|
||||
| [monitoring_config](variables.tf#L324) | Monitoring configuration. Google Cloud Managed Service for Prometheus is enabled by default. | <code title="object({ enable_system_metrics = optional(bool, true) enable_api_server_metrics = optional(bool, false) enable_controller_manager_metrics = optional(bool, false) enable_scheduler_metrics = optional(bool, false) enable_daemonset_metrics = optional(bool, false) enable_deployment_metrics = optional(bool, false) enable_hpa_metrics = optional(bool, false) enable_pod_metrics = optional(bool, false) enable_statefulset_metrics = optional(bool, false) enable_storage_metrics = optional(bool, false) enable_cadvisor_metrics = optional(bool, false) enable_managed_prometheus = optional(bool, true) advanced_datapath_observability = optional(object({ enable_metrics = bool enable_relay = bool })) })">object({…})</code> | | <code>{}</code> |
|
||||
| [node_config](variables.tf#L383) | Node-level configuration. | <code title="object({ boot_disk_kms_key = optional(string) k8s_labels = optional(map(string)) labels = optional(map(string)) service_account = optional(string) tags = optional(list(string)) workload_metadata_config_mode = optional(string) })">object({…})</code> | | <code>{}</code> |
|
||||
| [node_locations](variables.tf#L404) | Zones in which the cluster's nodes are located. | <code>list(string)</code> | | <code>[]</code> |
|
||||
| [release_channel](variables.tf#L416) | Release channel for GKE upgrades. | <code>string</code> | | <code>null</code> |
|
||||
| [location](variables.tf#L264) | Cluster zone or region. | <code>string</code> | ✓ | |
|
||||
| [name](variables.tf#L379) | Cluster name. | <code>string</code> | ✓ | |
|
||||
| [project_id](variables.tf#L412) | Cluster project id. | <code>string</code> | ✓ | |
|
||||
| [vpc_config](variables.tf#L423) | VPC-level configuration. | <code title="object({ disable_default_snat = optional(bool) network = string subnetwork = string secondary_range_blocks = optional(object({ pods = string services = string })) secondary_range_names = optional(object({ pods = optional(string) services = optional(string) })) additional_ranges = optional(list(string)) stack_type = optional(string) })">object({…})</code> | ✓ | |
|
||||
| [access_config](variables.tf#L17) | Control plane endpoint and nodes access configurations. | <code title="object({ dns_access = optional(bool, true) ip_access = optional(object({ authorized_ranges = optional(map(string), {}) disable_public_endpoint = optional(bool, true) gcp_public_cidrs_access_enabled = optional(bool, true) private_endpoint_config = optional(object({ endpoint_subnetwork = optional(string) global_access = optional(bool, true) }), {}) }), {}) private_nodes = optional(bool, true) })">object({…})</code> | | <code>{}</code> |
|
||||
| [backup_configs](variables.tf#L43) | Configuration for Backup for GKE. | <code title="object({ enable_backup_agent = optional(bool, false) backup_plans = optional(map(object({ region = string applications = optional(map(list(string))) encryption_key = optional(string) include_secrets = optional(bool, true) include_volume_data = optional(bool, true) labels = optional(map(string)) namespaces = optional(list(string)) schedule = optional(string) retention_policy_days = optional(number) retention_policy_lock = optional(bool, false) retention_policy_delete_lock_days = optional(number) })), {}) })">object({…})</code> | | <code>{}</code> |
|
||||
| [cluster_autoscaling](variables.tf#L65) | Enable and configure limits for Node Auto-Provisioning with Cluster Autoscaler. | <code title="object({ enabled = optional(bool, true) autoscaling_profile = optional(string, "BALANCED") auto_provisioning_defaults = optional(object({ boot_disk_kms_key = optional(string) disk_size = optional(number) disk_type = optional(string, "pd-standard") image_type = optional(string) oauth_scopes = optional(list(string)) service_account = optional(string) management = optional(object({ auto_repair = optional(bool, true) auto_upgrade = optional(bool, true) })) shielded_instance_config = optional(object({ integrity_monitoring = optional(bool, true) secure_boot = optional(bool, false) })) upgrade_settings = optional(object({ blue_green = optional(object({ node_pool_soak_duration = optional(string) standard_rollout_policy = optional(object({ batch_percentage = optional(number) batch_node_count = optional(number) batch_soak_duration = optional(string) })) })) surge = optional(object({ max = optional(number) unavailable = optional(number) })) })) })) cpu_limits = optional(object({ min = optional(number, 0) max = number })) mem_limits = optional(object({ min = optional(number, 0) max = number })) accelerator_resources = optional(list(object({ resource_type = string min = optional(number, 0) max = number }))) })">object({…})</code> | | <code>null</code> |
|
||||
| [default_nodepool](variables.tf#L144) | Enable default nodepool. | <code title="object({ remove_pool = optional(bool, true) initial_node_count = optional(number, 1) })">object({…})</code> | | <code>{}</code> |
|
||||
| [deletion_protection](variables.tf#L162) | 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. | <code>bool</code> | | <code>true</code> |
|
||||
| [description](variables.tf#L169) | Cluster description. | <code>string</code> | | <code>null</code> |
|
||||
| [enable_addons](variables.tf#L175) | Addons enabled in the cluster (true means enabled). | <code title="object({ cloudrun = optional(bool, false) config_connector = optional(bool, false) dns_cache = optional(bool, true) gce_persistent_disk_csi_driver = optional(bool, true) gcp_filestore_csi_driver = optional(bool, true) gcs_fuse_csi_driver = optional(bool, true) horizontal_pod_autoscaling = optional(bool, true) http_load_balancing = optional(bool, true) istio = optional(object({ enable_tls = bool })) kalm = optional(bool, false) network_policy = optional(bool, false) stateful_ha = optional(bool, false) })">object({…})</code> | | <code>{}</code> |
|
||||
| [enable_features](variables.tf#L197) | Enable cluster-level features. Certain features allow configuration. | <code title="object({ 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({ provider = optional(string) scope = optional(string) domain = optional(string) })) database_encryption = optional(object({ state = string key_name = string })) dataplane_v2 = optional(bool, true) fqdn_network_policy = optional(bool, true) gateway_api = optional(bool, false) groups_for_rbac = optional(string) image_streaming = optional(bool, false) intranode_visibility = optional(bool, false) l4_ilb_subsetting = optional(bool, false) mesh_certificates = optional(bool) pod_security_policy = optional(bool, false) secret_manager_config = optional(bool) security_posture_config = optional(object({ mode = string vulnerability_mode = string })) resource_usage_export = optional(object({ dataset = string enable_network_egress_metering = optional(bool) enable_resource_consumption_metering = optional(bool) })) service_external_ips = optional(bool, true) shielded_nodes = optional(bool, false) tpu = optional(bool, false) upgrade_notifications = optional(object({ topic_id = optional(string) })) vertical_pod_autoscaling = optional(bool, false) workload_identity = optional(bool, true) enterprise_cluster = optional(bool) })">object({…})</code> | | <code>{}</code> |
|
||||
| [issue_client_certificate](variables.tf#L251) | Enable issuing client certificate. | <code>bool</code> | | <code>false</code> |
|
||||
| [labels](variables.tf#L257) | Cluster resource labels. | <code>map(string)</code> | | <code>{}</code> |
|
||||
| [logging_config](variables.tf#L269) | Logging configuration. | <code title="object({ enable_system_logs = optional(bool, true) enable_workloads_logs = optional(bool, false) enable_api_server_logs = optional(bool, false) enable_scheduler_logs = optional(bool, false) enable_controller_manager_logs = optional(bool, false) })">object({…})</code> | | <code>{}</code> |
|
||||
| [maintenance_config](variables.tf#L290) | Maintenance window configuration. | <code title="object({ daily_window_start_time = optional(string) recurring_window = optional(object({ start_time = string end_time = string recurrence = string })) maintenance_exclusions = optional(list(object({ name = string start_time = string end_time = string scope = optional(string) }))) })">object({…})</code> | | <code title="{ daily_window_start_time = "03:00" recurring_window = null maintenance_exclusion = [] }">{…}</code> |
|
||||
| [max_pods_per_node](variables.tf#L313) | Maximum number of pods per node in this cluster. | <code>number</code> | | <code>110</code> |
|
||||
| [min_master_version](variables.tf#L319) | Minimum version of the master, defaults to the version of the most recent official release. | <code>string</code> | | <code>null</code> |
|
||||
| [monitoring_config](variables.tf#L325) | Monitoring configuration. Google Cloud Managed Service for Prometheus is enabled by default. | <code title="object({ enable_system_metrics = optional(bool, true) enable_api_server_metrics = optional(bool, false) enable_controller_manager_metrics = optional(bool, false) enable_scheduler_metrics = optional(bool, false) enable_daemonset_metrics = optional(bool, false) enable_deployment_metrics = optional(bool, false) enable_hpa_metrics = optional(bool, false) enable_pod_metrics = optional(bool, false) enable_statefulset_metrics = optional(bool, false) enable_storage_metrics = optional(bool, false) enable_cadvisor_metrics = optional(bool, false) enable_managed_prometheus = optional(bool, true) advanced_datapath_observability = optional(object({ enable_metrics = bool enable_relay = bool })) })">object({…})</code> | | <code>{}</code> |
|
||||
| [node_config](variables.tf#L384) | Node-level configuration. | <code title="object({ boot_disk_kms_key = optional(string) k8s_labels = optional(map(string)) labels = optional(map(string)) service_account = optional(string) tags = optional(list(string)) workload_metadata_config_mode = optional(string) })">object({…})</code> | | <code>{}</code> |
|
||||
| [node_locations](variables.tf#L405) | Zones in which the cluster's nodes are located. | <code>list(string)</code> | | <code>[]</code> |
|
||||
| [release_channel](variables.tf#L417) | Release channel for GKE upgrades. | <code>string</code> | | <code>null</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
||||
@@ -392,10 +392,15 @@ resource "google_container_cluster" "cluster" {
|
||||
}
|
||||
}
|
||||
dynamic "master_authorized_networks_config" {
|
||||
for_each = try(var.access_config.ip_access.authorized_ranges, null) != null ? [""] : []
|
||||
for_each = (
|
||||
try(var.access_config.ip_access.authorized_ranges, null) != null ||
|
||||
try(var.access_config.ip_access.gcp_public_cidrs_access_enabled, null) != null
|
||||
) ? [""] : []
|
||||
content {
|
||||
gcp_public_cidrs_access_enabled = try(var.access_config.ip_access.gcp_public_cidrs_access_enabled, null)
|
||||
|
||||
dynamic "cidr_blocks" {
|
||||
for_each = var.access_config.ip_access.authorized_ranges
|
||||
for_each = try(var.access_config.ip_access.authorized_ranges, {})
|
||||
iterator = range
|
||||
content {
|
||||
cidr_block = range.value
|
||||
|
||||
@@ -19,8 +19,9 @@ variable "access_config" {
|
||||
type = object({
|
||||
dns_access = optional(bool, true)
|
||||
ip_access = optional(object({
|
||||
authorized_ranges = optional(map(string), {})
|
||||
disable_public_endpoint = optional(bool, true)
|
||||
authorized_ranges = optional(map(string), {})
|
||||
disable_public_endpoint = optional(bool, true)
|
||||
gcp_public_cidrs_access_enabled = optional(bool, true)
|
||||
private_endpoint_config = optional(object({
|
||||
endpoint_subnetwork = optional(string)
|
||||
global_access = optional(bool, true)
|
||||
|
||||
Reference in New Issue
Block a user