From a5d1b7bb6361a2966c08bac851ec85857fc37b29 Mon Sep 17 00:00:00 2001 From: Satrajit Ghosh Date: Fri, 13 Jun 2025 08:12:51 -0400 Subject: [PATCH] enh: allow multiple instance types for aws This was squashed with the commit for fix: change check for multiple instance types and while rebasing we had a conflict for src/_nebari/stages/infrastructure/template/aws/modules/kubernetes/main.tf Annotation for our "manual patch queue": PR: https://github.com/nebari-dev/nebari/pull/3070 --- src/_nebari/stages/infrastructure/__init__.py | 9 +++++---- .../template/aws/modules/kubernetes/main.tf | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/_nebari/stages/infrastructure/__init__.py b/src/_nebari/stages/infrastructure/__init__.py index fb1d45d53..adb73feb8 100644 --- a/src/_nebari/stages/infrastructure/__init__.py +++ b/src/_nebari/stages/infrastructure/__init__.py @@ -619,10 +619,11 @@ def _check_input(cls, data: Any) -> Any: if hasattr(node_group, "__getitem__") else node_group.instance ) - if instance not in available_instances: - raise ValueError( - f"Amazon Web Services instance {node_group.instance} not one of available instance types={available_instances}" - ) + for instance_name in instance.split(","): + if instance_name not in available_instances: + raise ValueError( + f"Amazon Web Services instance {instance_name} not one of available instance types={available_instances}" + ) # check if kms key is valid available_kms_keys = amazon_web_services.kms_key_arns(data["region"]) diff --git a/src/_nebari/stages/infrastructure/template/aws/modules/kubernetes/main.tf b/src/_nebari/stages/infrastructure/template/aws/modules/kubernetes/main.tf index b0db3ac4a..9184fc4fe 100644 --- a/src/_nebari/stages/infrastructure/template/aws/modules/kubernetes/main.tf +++ b/src/_nebari/stages/infrastructure/template/aws/modules/kubernetes/main.tf @@ -91,7 +91,7 @@ resource "aws_eks_node_group" "main" { node_role_arn = aws_iam_role.node-group.arn subnet_ids = var.node_groups[count.index].single_subnet ? [element(var.cluster_subnets, 0)] : var.cluster_subnets - instance_types = [var.node_groups[count.index].instance_type] + instance_types = split(",", var.node_groups[count.index].instance_type) capacity_type = var.node_groups[count.index].spot ? "SPOT" : "ON_DEMAND" ami_type = var.node_groups[count.index].ami_type disk_size = var.node_groups[count.index].launch_template == null ? 50 : null