Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix validation and dynamic block for optional gpu_driver #1847

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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