Allows worker groups to be created using AWS Launch Templates (#222)

This commit is contained in:
skang0601
2019-01-10 09:19:19 -06:00
committed by Max Williams
parent 646831423a
commit f3ab7c67da
10 changed files with 218 additions and 14 deletions

View File

@@ -3,7 +3,7 @@ terraform {
}
provider "aws" {
version = ">= 1.24.0"
version = ">= 1.47.0"
region = "${var.region}"
}
@@ -41,15 +41,24 @@ locals {
worker_groups = [
{
instance_type = "t2.small"
additional_userdata = "echo foo bar"
subnets = "${join(",", module.vpc.private_subnets)}"
# This will launch an autoscaling group with only On-Demand instances
instance_type = "t2.small"
additional_userdata = "echo foo bar"
subnets = "${join(",", module.vpc.private_subnets)}"
asg_desired_capacity = "2"
},
]
worker_groups_launch_template = [
{
instance_type = "t2.small"
additional_userdata = "echo foo bar"
subnets = "${join(",", module.vpc.private_subnets)}"
additional_security_group_ids = "${aws_security_group.worker_group_mgmt_one.id},${aws_security_group.worker_group_mgmt_two.id}"
# This will launch an autoscaling group with only Spot Fleet instances
instance_type = "t2.small"
additional_userdata = "echo foo bar"
subnets = "${join(",", module.vpc.private_subnets)}"
additional_security_group_ids = "${aws_security_group.worker_group_mgmt_one.id},${aws_security_group.worker_group_mgmt_two.id}"
override_instance_type = "t3.small"
asg_desired_capacity = "2"
spot_instance_pools = 10
on_demand_percentage_above_base_capacity = "0"
},
]
tags = {
@@ -133,7 +142,9 @@ module "eks" {
tags = "${local.tags}"
vpc_id = "${module.vpc.vpc_id}"
worker_groups = "${local.worker_groups}"
worker_group_count = "2"
worker_groups_launch_template = "${local.worker_groups_launch_template}"
worker_group_count = "1"
worker_group_launch_template_count = "1"
worker_additional_security_group_ids = ["${aws_security_group.all_worker_mgmt.id}"]
map_roles = "${var.map_roles}"
map_roles_count = "${var.map_roles_count}"