Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for specifying elastic inference accelerator #1176

Merged
merged 4 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions examples/launch_templates/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,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"
},
]
}
1 change: 1 addition & 0 deletions local.tf
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,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(
Expand Down
12 changes: 12 additions & 0 deletions workers_launch_template.tf
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,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
}
}

barryib marked this conversation as resolved.
Show resolved Hide resolved
key_name = lookup(
var.worker_groups_launch_template[count.index],
"key_name",
Expand Down