From dea83a5b7d6b22993a9f13960e6a430fc279eab2 Mon Sep 17 00:00:00 2001 From: Rucha Kulkarni Date: Wed, 6 Jan 2021 08:52:58 +0530 Subject: [PATCH 1/2] feat: Add support for elastic inference accelerator --- local.tf | 1 + workers_launch_template.tf | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/local.tf b/local.tf index a07aec85fd..0fb24b6a33 100644 --- a/local.tf +++ b/local.tf @@ -93,6 +93,7 @@ locals { spot_instance_pools = 10 # "Number of Spot pools per availability zone to allocate capacity. EC2 Auto Scaling selects the cheapest Spot pools and evenly allocates Spot capacity across the number of Spot pools that you specify." spot_max_price = "" # Maximum price per unit hour that the user is willing to pay for the Spot instances. Default is the on-demand price max_instance_lifetime = 0 # Maximum number of seconds instances can run in the ASG. 0 is unlimited. + elastic_inference_accelerator = null # Type of elastic inference accelerator to be attached. Example values are eia1.medium, eia2.large, etc. } workers_group_defaults = merge( diff --git a/workers_launch_template.tf b/workers_launch_template.tf index d7c4b4156a..d757d496d7 100644 --- a/workers_launch_template.tf +++ b/workers_launch_template.tf @@ -282,6 +282,18 @@ resource "aws_launch_template" "workers_launch_template" { "instance_type", local.workers_group_defaults["instance_type"], ) + + dynamic "elastic_inference_accelerator" { + for_each = lookup( + var.worker_groups_launch_template[count.index], + "elastic_inference_accelerator", + local.workers_group_defaults["elastic_inference_accelerator"] + ) != null ? [lookup(var.worker_groups_launch_template[count.index], "elastic_inference_accelerator", local.workers_group_defaults["elastic_inference_accelerator"])] : [] + content { + type = elastic_inference_accelerator.value + } + } + key_name = lookup( var.worker_groups_launch_template[count.index], "key_name", From c71cb2d9251c0d910c1d355f73bd175b7208fd9d Mon Sep 17 00:00:00 2001 From: Rucha Kulkarni Date: Wed, 6 Jan 2021 09:34:19 +0530 Subject: [PATCH 2/2] Example usage --- examples/launch_templates/main.tf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/launch_templates/main.tf b/examples/launch_templates/main.tf index 40558d4d85..6195628db0 100644 --- a/examples/launch_templates/main.tf +++ b/examples/launch_templates/main.tf @@ -82,5 +82,12 @@ module "eks" { asg_desired_capacity = 1 public_ip = true }, + { + name = "worker-group-3" + instance_type = "t2.large" + asg_desired_capacity = 1 + public_ip = true + elastic_inference_accelerator = "eia2.medium" + }, ] }