Skip to content

Commit

Permalink
Merge pull request #1847 from Gilfar/fix-optional-gpu-driver
Browse files Browse the repository at this point in the history
Fix validation and dynamic block for optional gpu_driver in gke-nodepool
  • Loading branch information
Gilfar committed Nov 8, 2023
2 parents c7bef58 + fca89b5 commit 39edc43
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions modules/gke-nodepool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,7 @@ resource "google_container_node_pool" "nodepool" {
gpu_partition_size = var.node_config.guest_accelerator.gpu_driver == null ? null : var.node_config.guest_accelerator.gpu_driver.partition_size

dynamic "gpu_sharing_config" {
for_each = lookup(
lookup(var.node_config.guest_accelerator, "gpu_driver", {}),
"max_shared_clients_per_gpu"
) != null ? [""] : []
for_each = try(var.node_config.guest_accelerator.gpu_driver.max_shared_clients_per_gpu, null) != null ? [""] : []
content {
gpu_sharing_strategy = var.node_config.guest_accelerator.gpu_driver.max_shared_clients_per_gpu != null ? "TIME_SHARING" : null
max_shared_clients_per_gpu = var.node_config.guest_accelerator.gpu_driver.max_shared_clients_per_gpu
Expand Down
2 changes: 1 addition & 1 deletion modules/gke-nodepool/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ variable "node_config" {
validation {
condition = (
alltrue([
for k, v in var.node_config.guest_accelerator[*].gpu_driver : contains([
for k, v in try(var.node_config.guest_accelerator[0].gpu_driver, {}) : contains([
"GPU_DRIVER_VERSION_UNSPECIFIED", "INSTALLATION_DISABLED",
"DEFAULT", "LATEST"
], v.version)
Expand Down

0 comments on commit 39edc43

Please sign in to comment.