@@ -93,7 +93,7 @@ variable "desired_capacity" {
93
93
94
94
variable "associate_public_ip_address" {
95
95
description = " Should created instances be publicly accessible (if the SG allows)"
96
- default = false
96
+ default = false
97
97
}
98
98
99
99
variable "root_volume_size" {
@@ -126,35 +126,6 @@ variable "extra_cloud_config_content" {
126
126
default = " "
127
127
}
128
128
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
-
158
129
resource "aws_ecs_cluster" "main" {
159
130
name = " ${ var . name } "
160
131
@@ -198,7 +169,7 @@ resource "aws_launch_configuration" "main" {
198
169
ebs_optimized = " ${ var . instance_ebs_optimized } "
199
170
iam_instance_profile = " ${ var . iam_instance_profile } "
200
171
key_name = " ${ var . key_name } "
201
- security_groups = [" ${ aws_security_group . cluster . id } " ]
172
+ security_groups = [" ${ split ( " , " , var . security_groups ) } " ]
202
173
user_data = " ${ data . template_cloudinit_config . cloud_config . rendered } "
203
174
associate_public_ip_address = " ${ var . associate_public_ip_address } "
204
175
@@ -382,8 +353,3 @@ resource "aws_cloudwatch_metric_alarm" "memory_low" {
382
353
output "name" {
383
354
value = " ${ var . name } "
384
355
}
385
-
386
- // The cluster security group ID.
387
- output "security_group_id" {
388
- value = " ${ aws_security_group . cluster . id } "
389
- }
0 commit comments