Skip to content

Commit a3da13d

Browse files
fix: add required fields for GKE autopilot and standard cluster (#2461)
Co-authored-by: Andrew Peabody <[email protected]>
1 parent b589f64 commit a3da13d

File tree

8 files changed

+40
-47
lines changed

8 files changed

+40
-47
lines changed

modules/gke-autopilot-cluster/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ For a module with a complete configuration of a Google Cloud Platform Kubernetes
4141
| logging\_config | The GKE components exposing logs. Supported values include: SYSTEM\_COMPONENTS, APISERVER, CONTROLLER\_MANAGER, SCHEDULER, and WORKLOADS. | <pre>object({<br> enable_components = optional(list(string))<br> })</pre> | `null` | no |
4242
| maintenance\_policy | The maintenance policy to use for the cluster. | <pre>object({<br> daily_maintenance_window = optional(object({<br> start_time = optional(string)<br> }))<br> recurring_window = optional(object({<br> start_time = optional(string)<br> end_time = optional(string)<br> recurrence = optional(string)<br> }))<br> maintenance_exclusion = optional(list(object({<br> exclusion_name = optional(string)<br> start_time = optional(string)<br> end_time = optional(string)<br> exclusion_options = optional(object({<br> scope = optional(string)<br> }))<br> })))<br> })</pre> | <pre>{<br> "daily_maintenance_window": {<br> "start_time": "05:00"<br> }<br>}</pre> | no |
4343
| master\_auth | The authentication information for accessing the Kubernetes master. | <pre>object({<br> client_certificate_config = optional(object({<br> issue_client_certificate = optional(bool)<br> }))<br> })</pre> | `null` | no |
44-
| master\_authorized\_networks\_config | The desired configuration options for master authorized networks. | <pre>object({<br> cidr_blocks = optional(list(object({<br> display_name = optional(string)<br> cidr_block = optional(string)<br> })))<br> gcp_public_cidrs_access_enabled = optional(bool)<br> private_endpoint_enforcement_enabled = optional(bool)<br> })</pre> | `null` | no |
44+
| master\_authorized\_networks\_config | The desired configuration options for master authorized networks. | <pre>object({<br> cidr_blocks = list(object({<br> display_name = string<br> cidr_block = string<br> }))<br> gcp_public_cidrs_access_enabled = optional(bool)<br> private_endpoint_enforcement_enabled = optional(bool)<br> })</pre> | n/a | yes |
4545
| mesh\_certificates | Configuration for the provisioning of managed mesh certificates. | <pre>object({<br> enable_certificates = optional(bool)<br> })</pre> | `null` | no |
4646
| min\_master\_version | The minimum version of the master. GKE will auto-update the master to new versions, so this does not guarantee the master version--use the read-only master\_version field to obtain a current version. If unset, the server's default version will be used. | `string` | `null` | no |
4747
| monitoring\_config | (Optional) The GKE components exposing metrics. Supported values include: SYSTEM\_COMPONENTS, APISERVER, SCHEDULER, CONTROLLER\_MANAGER, STORAGE, HPA, POD, DAEMONSET, DEPLOYMENT, STATEFULSET, KUBELET, CADVISOR, DCGM and JOBSET. | <pre>object({<br> enable_components = optional(list(string))<br> })</pre> | `null` | no |
@@ -54,7 +54,7 @@ For a module with a complete configuration of a Google Cloud Platform Kubernetes
5454
| pod\_security\_policy\_config | Configuration for the [PodSecurityPolicy](https://cloud.google.com/kubernetes-engine/docs/how-to/pod-security-policies) feature. | <pre>object({<br> enabled = bool<br> })</pre> | `null` | no |
5555
| private\_cluster\_config | Configuration for private clusters, clusters with private nodes. | <pre>object({<br> enable_private_nodes = optional(bool)<br> enable_private_endpoint = optional(bool)<br> master_ipv4_cidr_block = optional(string)<br> private_endpoint_subnetwork = optional(string)<br> master_global_access_config = optional(object({<br> enabled = optional(bool)<br> }))<br> })</pre> | <pre>{<br> "enable_private_endpoint": true,<br> "enable_private_nodes": true,<br> "master_global_access_config": {<br> "enabled": true<br> }<br>}</pre> | no |
5656
| private\_ipv6\_google\_access | The desired state of IPv6 access to Google Services. By default, no private IPv6 access to or from Google Services (all access will be via IPv4). | `string` | `null` | no |
57-
| project\_id | The ID of the project in which the resource belongs. If it is not provided, the provider project is used. | `string` | n/a | yes |
57+
| project\_id | The ID of the project in which the resource belongs. | `string` | n/a | yes |
5858
| protect\_config | Enable/Disable Protect API features for the cluster. | <pre>object({<br> workload_config = object({<br> audit_mode = string<br> })<br> workload_vulnerability_mode = optional(string)<br> })</pre> | `null` | no |
5959
| release\_channel | The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `REGULAR`. | <pre>object({<br> channel = optional(string)<br> })</pre> | <pre>{<br> "channel": "REGULAR"<br>}</pre> | no |
6060
| resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field 'effective\_labels' for all of the labels present on the resource. | `map(string)` | `null` | no |
@@ -66,7 +66,7 @@ For a module with a complete configuration of a Google Cloud Platform Kubernetes
6666
| timeouts | Timeout for cluster operations. | <pre>object({<br> create = optional(string)<br> update = optional(string)<br> delete = optional(string)<br> })</pre> | <pre>{<br> "create": "45m",<br> "delete": "45m",<br> "update": "45m"<br>}</pre> | no |
6767
| vertical\_pod\_autoscaling | Vertical Pod Autoscaling automatically adjusts the resources of pods controlled by it. | <pre>object({<br> enabled = optional(bool)<br> })</pre> | <pre>{<br> "enabled": true<br>}</pre> | no |
6868
| workload\_alts\_config | Workload ALTS configuration for the cluster. Whether the alts handshaker should be enabled or not for direct-path. Requires Workload Identity (workloadPool) must be non-empty | <pre>object({<br> enable_alts = bool<br> })</pre> | `null` | no |
69-
| workload\_identity\_config | Configuration for the use of Kubernetes Service Accounts in GCP IAM policies. | <pre>object({<br> workload_pool = optional(string)<br> })</pre> | `null` | no |
69+
| workload\_identity\_config | Configuration for the use of Kubernetes Service Accounts in GCP IAM policies. | <pre>object({<br> workload_pool = string<br> })</pre> | n/a | yes |
7070

7171
## Outputs
7272

modules/gke-autopilot-cluster/metadata.display.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,6 @@ spec:
256256
master_authorized_networks_config:
257257
name: master_authorized_networks_config
258258
title: Master Authorized Networks Config
259-
altDefaults:
260-
- type: ALTERNATE_TYPE_DC
261-
value:
262-
private_endpoint_enforcement_enabled: true
263259
mesh_certificates:
264260
name: mesh_certificates
265261
title: Mesh Certificates

modules/gke-autopilot-cluster/metadata.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ spec:
135135
varType: string
136136
defaultValue: ""
137137
- name: project_id
138-
description: The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
138+
description: The ID of the project in which the resource belongs.
139139
varType: string
140140
required: true
141141
- name: location
@@ -277,13 +277,14 @@ spec:
277277
description: The desired configuration options for master authorized networks.
278278
varType: |-
279279
object({
280-
cidr_blocks = optional(list(object({
281-
display_name = optional(string)
282-
cidr_block = optional(string)
283-
})))
280+
cidr_blocks = list(object({
281+
display_name = string
282+
cidr_block = string
283+
}))
284284
gcp_public_cidrs_access_enabled = optional(bool)
285285
private_endpoint_enforcement_enabled = optional(bool)
286286
})
287+
required: true
287288
- name: min_master_version
288289
description: The minimum version of the master. GKE will auto-update the master to new versions, so this does not guarantee the master version--use the read-only master_version field to obtain a current version. If unset, the server's default version will be used.
289290
varType: string
@@ -426,8 +427,9 @@ spec:
426427
description: Configuration for the use of Kubernetes Service Accounts in GCP IAM policies.
427428
varType: |-
428429
object({
429-
workload_pool = optional(string)
430+
workload_pool = string
430431
})
432+
required: true
431433
- name: identity_service_config
432434
description: Whether to enable the Identity Service component. It is disabled by default. Set enabled=true to enable.
433435
varType: |-

modules/gke-autopilot-cluster/variables.tf

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ variable "description" {
2727
}
2828

2929
variable "project_id" {
30-
description = "The ID of the project in which the resource belongs. If it is not provided, the provider project is used."
30+
description = "The ID of the project in which the resource belongs."
3131
type = string
3232
}
3333

@@ -203,14 +203,13 @@ variable "master_auth" {
203203
variable "master_authorized_networks_config" {
204204
description = "The desired configuration options for master authorized networks."
205205
type = object({
206-
cidr_blocks = optional(list(object({
207-
display_name = optional(string)
208-
cidr_block = optional(string)
209-
})))
206+
cidr_blocks = list(object({
207+
display_name = string
208+
cidr_block = string
209+
}))
210210
gcp_public_cidrs_access_enabled = optional(bool)
211211
private_endpoint_enforcement_enabled = optional(bool)
212212
})
213-
default = null
214213
}
215214

216215
variable "min_master_version" {
@@ -394,9 +393,8 @@ variable "resource_usage_export_config" {
394393
variable "workload_identity_config" {
395394
description = "Configuration for the use of Kubernetes Service Accounts in GCP IAM policies."
396395
type = object({
397-
workload_pool = optional(string)
396+
workload_pool = string
398397
})
399-
default = null
400398
}
401399

402400
variable "identity_service_config" {

0 commit comments

Comments
 (0)