@@ -93,7 +93,7 @@ variable "desired_capacity" {
9393
9494variable "associate_public_ip_address" {
9595 description = " Should created instances be publicly accessible (if the SG allows)"
96- default = false
96+ default = false
9797}
9898
9999variable "root_volume_size" {
@@ -126,35 +126,6 @@ variable "extra_cloud_config_content" {
126126 default = " "
127127}
128128
129- resource "aws_security_group" "cluster" {
130- name = " ${ var . name } -ecs-cluster"
131- vpc_id = " ${ var . vpc_id } "
132- description = " Allows traffic from and to the EC2 instances of the ${ var . name } ECS cluster"
133-
134- ingress {
135- from_port = 0
136- to_port = 0
137- protocol = - 1
138- security_groups = [" ${ split (" ," , var. security_groups )} " ]
139- }
140-
141- egress {
142- from_port = 0
143- to_port = 0
144- protocol = - 1
145- cidr_blocks = [" 0.0.0.0/0" ]
146- }
147-
148- tags {
149- Name = " ECS cluster (${ var . name } )"
150- Environment = " ${ var . environment } "
151- }
152-
153- lifecycle {
154- create_before_destroy = true
155- }
156- }
157-
158129resource "aws_ecs_cluster" "main" {
159130 name = " ${ var . name } "
160131
@@ -198,7 +169,7 @@ resource "aws_launch_configuration" "main" {
198169 ebs_optimized = " ${ var . instance_ebs_optimized } "
199170 iam_instance_profile = " ${ var . iam_instance_profile } "
200171 key_name = " ${ var . key_name } "
201- security_groups = [" ${ aws_security_group . cluster . id } " ]
172+ security_groups = [" ${ split ( " , " , var . security_groups ) } " ]
202173 user_data = " ${ data . template_cloudinit_config . cloud_config . rendered } "
203174 associate_public_ip_address = " ${ var . associate_public_ip_address } "
204175
@@ -382,8 +353,3 @@ resource "aws_cloudwatch_metric_alarm" "memory_low" {
382353output "name" {
383354 value = " ${ var . name } "
384355}
385-
386- // The cluster security group ID.
387- output "security_group_id" {
388- value = " ${ aws_security_group . cluster . id } "
389- }
0 commit comments