Skip to content

Commit

Permalink
Updated tf functions to actually work, removing tf plan
Browse files Browse the repository at this point in the history
  • Loading branch information
mclacore committed May 7, 2024
1 parent 4152193 commit 2f08291
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion core-services/nvidia_gpu.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
locals {
has_gpu = length(coalesce([for ng in var.node_groups : length(regexall("^p[0-9]\\..*", ng.instance_type)) > 1 ? "gpu" : ""])) > 0
}

resource "kubernetes_daemonset" "nvidia" {
count = length([for ng in var.node_groups : ng if can(regex("^[p0-9]\\..*", ng.instance_type))]) > 0 ? 1 : 0
count = local.has_gpu ? 1 : 0
metadata {
name = "nvidia-device-plugin-daemonset"
namespace = kubernetes_namespace_v1.md-core-services.metadata.0.name
Expand Down
Binary file removed core-services/tf.plan
Binary file not shown.
Binary file removed custom-resources/tf.plan
Binary file not shown.
2 changes: 1 addition & 1 deletion src/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ resource "aws_eks_node_group" "node_group" {
}

dynamic "taint" {
for_each = [for ng in var.node_groups : ng if can(regex("^p[0-9]\\..*", ng.instance_type))]
for_each = length(regexall("^p[0-9]\\..*", each.value.instance_type)) > 0 ? toset(["gpu"]) : toset([])
content {
key = "sku"
value = "gpu"
Expand Down

0 comments on commit 2f08291

Please sign in to comment.