diff --git a/base.tf.j2 b/base.tf.j2 index 0058fc3..3f92a29 100644 --- a/base.tf.j2 +++ b/base.tf.j2 @@ -420,11 +420,14 @@ resource "kubernetes_deployment" "main" { {% endblock %} {% block kubernetes_pod_main_tolerations %} - toleration { + dynamic "gpu_toleration" { for_each = data.coder_parameter.gpu.value == 0 ? [] : [1] - key = "nvidia.com/gpu" - operator = "Exists" - effect = "NoSchedule" + + toleration { + key = "nvidia.com/gpu" + operator = "Exists" + effect = "NoSchedule" + } } {% endblock %}