From 71060c82fe57c9723bc9a8263e951324d2a4068f Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Mon, 23 Apr 2018 15:44:18 -0600 Subject: [PATCH] Ability to specify additional security groups --- modules/consul-cluster/main.tf | 2 +- modules/consul-cluster/variables.tf | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/consul-cluster/main.tf b/modules/consul-cluster/main.tf index 1ec17a71..10cf2a80 100644 --- a/modules/consul-cluster/main.tf +++ b/modules/consul-cluster/main.tf @@ -56,7 +56,7 @@ resource "aws_launch_configuration" "launch_configuration" { iam_instance_profile = "${aws_iam_instance_profile.instance_profile.name}" key_name = "${var.ssh_key_name}" - security_groups = ["${aws_security_group.lc_security_group.id}"] + security_groups = ["${concat(list(aws_security_group.lc_security_group.id), var.additional_security_group_ids)}"] placement_tenancy = "${var.tenancy}" associate_public_ip_address = "${var.associate_public_ip_address}" diff --git a/modules/consul-cluster/variables.tf b/modules/consul-cluster/variables.tf index 7b903dd4..5bee0b25 100644 --- a/modules/consul-cluster/variables.tf +++ b/modules/consul-cluster/variables.tf @@ -83,6 +83,12 @@ variable "allowed_inbound_security_group_ids" { default = [] } +variable "additional_security_group_ids" { + description = "A list of additional security group IDs to add to Consul EC2 Instances" + type = "list" + default = [] +} + variable "termination_policies" { description = "A list of policies to decide how the instances in the auto scale group should be terminated. The allowed values are OldestInstance, NewestInstance, OldestLaunchConfiguration, ClosestToNextInstanceHour, Default." default = "Default"