20482: Allows setting instance types per service node.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Thu, 11 May 2023 12:40:05 +0000 (09:40 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Thu, 11 May 2023 12:40:05 +0000 (09:40 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

tools/salt-install/terraform/aws/services/main.tf
tools/salt-install/terraform/aws/services/terraform.tfvars
tools/salt-install/terraform/aws/services/variables.tf

index fbbcabab3319fa36c896bff91942d9b8cfc6c68a..48b6ef23cb6b5160831baafb5b20ce15b5b3c244 100644 (file)
@@ -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,
index 4be0edd59f3be6b54bd7703d815e6403f283120e..856ea2396e03ae022d0e5f38d0be8a4c3cfc4677 100644 (file)
@@ -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"
index 99005a22038ef99bc83b0c58ffb0f8df11d50593..08675a84f4fd1baeb6aae923b65a75d7a2895fb1 100644 (file)
@@ -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" {