From b075388ebe7b844965a0ca7b42a9bb51ce285859 Mon Sep 17 00:00:00 2001 From: Igor Borodin Date: Thu, 14 Jun 2018 14:51:37 +0300 Subject: [PATCH] Allow adding SSH keys to worker ASGs --- variables.tf | 1 + workers.tf | 1 + 2 files changed, 2 insertions(+) diff --git a/variables.tf b/variables.tf index 8020b3c..4547ee9 100644 --- a/variables.tf +++ b/variables.tf @@ -56,6 +56,7 @@ variable "workers_group_defaults" { asg_max_size = "3" # Maximum worker capacity in the autoscaling group. asg_min_size = "1" # Minimum worker capacity in the autoscaling group. instance_type = "m4.large" # Size of the workers instances. + key_name = "" # The key name that should be used for the instances in the autoscaling group additional_userdata = "" # userdata to append to the default userdata. ebs_optimized = true # sets whether to use ebs optimization on supported types. } diff --git a/workers.tf b/workers.tf index 1056712..b798a54 100644 --- a/workers.tf +++ b/workers.tf @@ -23,6 +23,7 @@ resource "aws_launch_configuration" "workers" { iam_instance_profile = "${aws_iam_instance_profile.workers.id}" image_id = "${lookup(var.worker_groups[count.index], "ami_id", data.aws_ami.eks_worker.id)}" instance_type = "${lookup(var.worker_groups[count.index], "instance_type", lookup(var.workers_group_defaults, "instance_type"))}" + key_name = "${lookup(var.worker_groups[count.index], "key_name", lookup(var.workers_group_defaults, "key_name"))}" user_data_base64 = "${base64encode(element(data.template_file.userdata.*.rendered, count.index))}" ebs_optimized = "${lookup(var.worker_groups[count.index], "ebs_optimized", lookup(local.ebs_optimized, lookup(var.worker_groups[count.index], "instance_type", lookup(var.workers_group_defaults, "instance_type")), false))}" count = "${length(var.worker_groups)}"