Skip to content

Commit c5024f0

Browse files
authored
Merge pull request #1 from Edencia/stack_join_security_groups
Stack join security groups
2 parents 5fa6c19 + eec2ef7 commit c5024f0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

main.tf

+6-1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ variable "ecs_security_groups" {
124124
default = ""
125125
}
126126

127+
variable "ecs_extra_security_groups" {
128+
description = "A comma separated list of security groups added to the default security groups of the stack"
129+
default = ""
130+
}
131+
127132
variable "ecs_ami" {
128133
description = "The AMI that will be used to launch EC2 instances in the ECS cluster"
129134
default = ""
@@ -221,7 +226,7 @@ module "ecs_cluster" {
221226
docker_volume_size = "${var.ecs_docker_volume_size}"
222227
docker_auth_type = "${var.ecs_docker_auth_type}"
223228
docker_auth_data = "${var.ecs_docker_auth_data}"
224-
security_groups = "${coalesce(var.ecs_security_groups, format("%s,%s,%s", module.security_groups.internal_ssh, module.security_groups.internal_elb, module.security_groups.external_elb))}"
229+
security_groups = "${coalesce(var.ecs_security_groups, join(",", compact(concat(split(",", "${format("%s,%s,%s", module.security_groups.internal_ssh, module.security_groups.internal_elb, module.security_groups.external_elb)}"), split(",", "${var.ecs_extra_security_groups}")))))}"
225230
extra_cloud_config_type = "${var.extra_cloud_config_type}"
226231
extra_cloud_config_content = "${var.extra_cloud_config_content}"
227232
}

0 commit comments

Comments
 (0)