Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ resource "google_container_node_pool" "pools" {
disk_type = lookup(each.value, "disk_type", "pd-standard")

dynamic "ephemeral_storage_local_ssd_config" {
for_each = lookup(each.value, "local_ssd_ephemeral_storage_count", 0) > 0 || lookup(each.value, "ephemeral_storage_local_ssd_data_cache_count", 0) > 0 ? [1] : []
for_each = lookup(each.value, "local_ssd_ephemeral_storage_count", 0) >= 0 || lookup(each.value, "ephemeral_storage_local_ssd_data_cache_count", 0) > 0 ? [1] : []

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This change should be applied to the template file autogen/main/cluster.tf.tmpl instead of this generated file. Otherwise, it will be overwritten.

Additionally, the condition lookup(each.value, "local_ssd_ephemeral_storage_count", 0) >= 0 is too broad. Since lookup with a default value of 0 will always return a number greater than or equal to zero, this will cause the ephemeral_storage_local_ssd_config block to be created for all node pools, which may have unintended consequences for node pools that do not support this configuration.

Based on your description, the issue is specific to disk_type = "hyperdisk-balanced". A safer approach is to add this specific case to the condition, preserving the original logic for other cases.

      for_each = lookup(each.value, "local_ssd_ephemeral_storage_count", 0) > 0 || lookup(each.value, "ephemeral_storage_local_ssd_data_cache_count", 0) > 0 || lookup(each.value, "disk_type", "pd-standard") == "hyperdisk-balanced" ? [1] : []

Copy link
Author

@shlomimn shlomimn Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

@shlomimn shlomimn Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the suggested answer,
Since we are dealing with ssd and since it is suggested my solution is too broad,
the I think we can add the following change instead:

dynamic "ephemeral_storage_local_ssd_config" {
for_each = lookup(each.value, "local_ssd_ephemeral_storage_count", 0) > 0 || lookup(each.value, "ephemeral_storage_local_ssd_data_cache_count", 0) || lookup(each.value, "disk_type", "pd-ssd") == "hyperdisk-balanced" > 0 ? [1] : []
content {
local_ssd_count = lookup(each.value, "local_ssd_ephemeral_storage_count", 0)
data_cache_count = lookup(each.value, "ephemeral_storage_local_ssd_data_cache_count", 0)
}
}

content {
local_ssd_count = lookup(each.value, "local_ssd_ephemeral_storage_count", 0)
data_cache_count = lookup(each.value, "ephemeral_storage_local_ssd_data_cache_count", 0)
Expand Down