Skip to content

Commit 7d9bd3d

Browse files
author
Alex Sonn
committed
fix(cgroup): Make value empty by default instead of null
1 parent 03f2abe commit 7d9bd3d

File tree

8 files changed

+17
-17
lines changed

8 files changed

+17
-17
lines changed

autogen/main/cluster.tf.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ resource "google_container_cluster" "primary" {
279279
}
280280
{% if autopilot_cluster %}
281281
dynamic "node_pool_auto_config" {
282-
for_each = length(var.network_tags) > 0 || var.add_cluster_firewall_rules || var.add_master_webhook_firewall_rules || var.add_shadow_firewall_rules || var.insecure_kubelet_readonly_port_enabled != null || var.node_pools_cgroup_mode != null ? [1] : []
282+
for_each = length(var.network_tags) > 0 || var.add_cluster_firewall_rules || var.add_master_webhook_firewall_rules || var.add_shadow_firewall_rules || var.insecure_kubelet_readonly_port_enabled != null || var.node_pools_cgroup_mode != "" ? [1] : []
283283
content {
284284
network_tags {
285285
tags = var.add_cluster_firewall_rules || var.add_master_webhook_firewall_rules || var.add_shadow_firewall_rules ? concat(var.network_tags, [local.cluster_network_tag]) : length(var.network_tags) > 0 ? var.network_tags : null
@@ -293,7 +293,7 @@ resource "google_container_cluster" "primary" {
293293
}
294294

295295
dynamic "linux_node_config" {
296-
for_each = (var.node_pools_cgroup_mode != null) ? [1] : []
296+
for_each = (var.node_pools_cgroup_mode != "") ? [1] : []
297297

298298
content {
299299
cgroup_mode = var.node_pools_cgroup_mode

autogen/main/variables.tf.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,18 +537,18 @@ variable "node_pools_cgroup_mode" {
537537
type = string
538538
description = "String contains cgroup node config for Autopilot node pools"
539539

540-
default = null
540+
default = ""
541541

542542
validation {
543-
condition = var.node_pools_cgroup_mode == null || contains(
543+
condition = var.node_pools_cgroup_mode == "" || contains(
544544
[
545545
"CGROUP_MODE_UNSPECIFIED",
546546
"CGROUP_MODE_V1",
547547
"CGROUP_MODE_V2"
548548
],
549549
var.node_pools_cgroup_mode
550550
)
551-
error_message = "The value for node_pools_cgroup_mode must be one of: CGROUP_MODE_UNSPECIFIED, CGROUP_MODE_V1, CGROUP_MODE_V2, or null."
551+
error_message = "The value for node_pools_cgroup_mode must be one of: CGROUP_MODE_UNSPECIFIED, CGROUP_MODE_V1, CGROUP_MODE_V2"
552552
}
553553
}
554554
{% endif %}

modules/beta-autopilot-private-cluster/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Then perform the following commands on the root folder:
134134
| network | The VPC network to host the cluster in (required) | `string` | n/a | yes |
135135
| network\_project\_id | The project ID of the shared VPC's host (for shared vpc support) | `string` | `""` | no |
136136
| network\_tags | (Optional) - List of network tags applied to auto-provisioned node pools. | `list(string)` | `[]` | no |
137-
| node\_pools\_cgroup\_mode | String contains cgroup node config for Autopilot node pools | `string` | `null` | no |
137+
| node\_pools\_cgroup\_mode | String contains cgroup node config for Autopilot node pools | `string` | `""` | no |
138138
| non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | `list(string)` | <pre>[<br> "10.0.0.0/8",<br> "172.16.0.0/12",<br> "192.168.0.0/16"<br>]</pre> | no |
139139
| notification\_config\_topic | The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. | `string` | `""` | no |
140140
| notification\_filter\_event\_type | Choose what type of notifications you want to receive. If no filters are applied, you'll receive all notification types. Can be used to filter what notifications are sent. Accepted values are UPGRADE\_AVAILABLE\_EVENT, UPGRADE\_EVENT, and SECURITY\_BULLETIN\_EVENT. | `list(string)` | `[]` | no |

modules/beta-autopilot-private-cluster/cluster.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ resource "google_container_cluster" "primary" {
135135
}
136136
}
137137
dynamic "node_pool_auto_config" {
138-
for_each = length(var.network_tags) > 0 || var.add_cluster_firewall_rules || var.add_master_webhook_firewall_rules || var.add_shadow_firewall_rules || var.insecure_kubelet_readonly_port_enabled != null || var.node_pools_cgroup_mode != null ? [1] : []
138+
for_each = length(var.network_tags) > 0 || var.add_cluster_firewall_rules || var.add_master_webhook_firewall_rules || var.add_shadow_firewall_rules || var.insecure_kubelet_readonly_port_enabled != null || var.node_pools_cgroup_mode != "" ? [1] : []
139139
content {
140140
network_tags {
141141
tags = var.add_cluster_firewall_rules || var.add_master_webhook_firewall_rules || var.add_shadow_firewall_rules ? concat(var.network_tags, [local.cluster_network_tag]) : length(var.network_tags) > 0 ? var.network_tags : null
@@ -149,7 +149,7 @@ resource "google_container_cluster" "primary" {
149149
}
150150

151151
dynamic "linux_node_config" {
152-
for_each = (var.node_pools_cgroup_mode != null) ? [1] : []
152+
for_each = (var.node_pools_cgroup_mode != "") ? [1] : []
153153

154154
content {
155155
cgroup_mode = var.node_pools_cgroup_mode

modules/beta-autopilot-private-cluster/variables.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,18 +329,18 @@ variable "node_pools_cgroup_mode" {
329329
type = string
330330
description = "String contains cgroup node config for Autopilot node pools"
331331

332-
default = null
332+
default = ""
333333

334334
validation {
335-
condition = var.node_pools_cgroup_mode == null || contains(
335+
condition = var.node_pools_cgroup_mode == "" || contains(
336336
[
337337
"CGROUP_MODE_UNSPECIFIED",
338338
"CGROUP_MODE_V1",
339339
"CGROUP_MODE_V2"
340340
],
341341
var.node_pools_cgroup_mode
342342
)
343-
error_message = "The value for node_pools_cgroup_mode must be one of: CGROUP_MODE_UNSPECIFIED, CGROUP_MODE_V1, CGROUP_MODE_V2, or null."
343+
error_message = "The value for node_pools_cgroup_mode must be one of: CGROUP_MODE_UNSPECIFIED, CGROUP_MODE_V1, CGROUP_MODE_V2"
344344
}
345345
}
346346

modules/beta-autopilot-public-cluster/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Then perform the following commands on the root folder:
124124
| network | The VPC network to host the cluster in (required) | `string` | n/a | yes |
125125
| network\_project\_id | The project ID of the shared VPC's host (for shared vpc support) | `string` | `""` | no |
126126
| network\_tags | (Optional) - List of network tags applied to auto-provisioned node pools. | `list(string)` | `[]` | no |
127-
| node\_pools\_cgroup\_mode | String contains cgroup node config for Autopilot node pools | `string` | `null` | no |
127+
| node\_pools\_cgroup\_mode | String contains cgroup node config for Autopilot node pools | `string` | `""` | no |
128128
| non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | `list(string)` | <pre>[<br> "10.0.0.0/8",<br> "172.16.0.0/12",<br> "192.168.0.0/16"<br>]</pre> | no |
129129
| notification\_config\_topic | The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. | `string` | `""` | no |
130130
| notification\_filter\_event\_type | Choose what type of notifications you want to receive. If no filters are applied, you'll receive all notification types. Can be used to filter what notifications are sent. Accepted values are UPGRADE\_AVAILABLE\_EVENT, UPGRADE\_EVENT, and SECURITY\_BULLETIN\_EVENT. | `list(string)` | `[]` | no |

modules/beta-autopilot-public-cluster/cluster.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ resource "google_container_cluster" "primary" {
135135
}
136136
}
137137
dynamic "node_pool_auto_config" {
138-
for_each = length(var.network_tags) > 0 || var.add_cluster_firewall_rules || var.add_master_webhook_firewall_rules || var.add_shadow_firewall_rules || var.insecure_kubelet_readonly_port_enabled != null || var.node_pools_cgroup_mode != null ? [1] : []
138+
for_each = length(var.network_tags) > 0 || var.add_cluster_firewall_rules || var.add_master_webhook_firewall_rules || var.add_shadow_firewall_rules || var.insecure_kubelet_readonly_port_enabled != null || var.node_pools_cgroup_mode != "" ? [1] : []
139139
content {
140140
network_tags {
141141
tags = var.add_cluster_firewall_rules || var.add_master_webhook_firewall_rules || var.add_shadow_firewall_rules ? concat(var.network_tags, [local.cluster_network_tag]) : length(var.network_tags) > 0 ? var.network_tags : null
@@ -149,7 +149,7 @@ resource "google_container_cluster" "primary" {
149149
}
150150

151151
dynamic "linux_node_config" {
152-
for_each = (var.node_pools_cgroup_mode != null) ? [1] : []
152+
for_each = (var.node_pools_cgroup_mode != "") ? [1] : []
153153

154154
content {
155155
cgroup_mode = var.node_pools_cgroup_mode

modules/beta-autopilot-public-cluster/variables.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,18 +293,18 @@ variable "node_pools_cgroup_mode" {
293293
type = string
294294
description = "String contains cgroup node config for Autopilot node pools"
295295

296-
default = null
296+
default = ""
297297

298298
validation {
299-
condition = var.node_pools_cgroup_mode == null || contains(
299+
condition = var.node_pools_cgroup_mode == "" || contains(
300300
[
301301
"CGROUP_MODE_UNSPECIFIED",
302302
"CGROUP_MODE_V1",
303303
"CGROUP_MODE_V2"
304304
],
305305
var.node_pools_cgroup_mode
306306
)
307-
error_message = "The value for node_pools_cgroup_mode must be one of: CGROUP_MODE_UNSPECIFIED, CGROUP_MODE_V1, CGROUP_MODE_V2, or null."
307+
error_message = "The value for node_pools_cgroup_mode must be one of: CGROUP_MODE_UNSPECIFIED, CGROUP_MODE_V1, CGROUP_MODE_V2"
308308
}
309309
}
310310

0 commit comments

Comments
 (0)