From 705c7711ba7a741c85a57d260cc63e8183373a86 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Thu, 11 May 2023 09:40:05 -0300 Subject: [PATCH] 20482: Allows setting instance types per service node. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- tools/salt-install/terraform/aws/services/main.tf | 2 +- .../terraform/aws/services/terraform.tfvars | 7 +++++-- tools/salt-install/terraform/aws/services/variables.tf | 10 ++++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tools/salt-install/terraform/aws/services/main.tf b/tools/salt-install/terraform/aws/services/main.tf index fbbcabab33..48b6ef23cb 100644 --- a/tools/salt-install/terraform/aws/services/main.tf +++ b/tools/salt-install/terraform/aws/services/main.tf @@ -48,7 +48,7 @@ resource "aws_iam_instance_profile" "default_instance_profile" { resource "aws_instance" "arvados_service" { for_each = toset(concat(local.public_hosts, local.private_hosts)) ami = local.instance_ami_id - instance_type = var.default_instance_type + instance_type = try(var.instance_type[each.value], var.instance_type.default) user_data = templatefile("user_data.sh", { "hostname": each.value, "deploy_user": var.deploy_user, diff --git a/tools/salt-install/terraform/aws/services/terraform.tfvars b/tools/salt-install/terraform/aws/services/terraform.tfvars index 4be0edd59f..856ea2396e 100644 --- a/tools/salt-install/terraform/aws/services/terraform.tfvars +++ b/tools/salt-install/terraform/aws/services/terraform.tfvars @@ -5,8 +5,11 @@ # Set to a specific SSH public key path. Default: ~/.ssh/id_rsa.pub # pubkey_path = "/path/to/pub.key" -# Set the instance type for your hosts. Default: m5a.large -# default_instance_type = "t2.micro" +# Set the instance type for your nodes. Default: m5a.large +# instance_type = { +# default = "m5a.xlarge" +# controller = "c5a.4xlarge" +# } # AWS secret's name which holds the SSL certificate private key's password. # Default: "arvados-ssl-privkey-password" diff --git a/tools/salt-install/terraform/aws/services/variables.tf b/tools/salt-install/terraform/aws/services/variables.tf index 99005a2203..08675a84f4 100644 --- a/tools/salt-install/terraform/aws/services/variables.tf +++ b/tools/salt-install/terraform/aws/services/variables.tf @@ -2,10 +2,12 @@ # # SPDX-License-Identifier: CC-BY-SA-3.0 -variable "default_instance_type" { - description = "The default EC2 instance type to use on the nodes" - type = string - default = "m5a.large" +variable "instance_type" { + description = "The EC2 instance types to use per service node" + type = map(string) + default = { + default = "m5a.large" + } } variable "pubkey_path" { -- 2.30.2