@@ -149,48 +149,37 @@ resource "aws_vpc_endpoint" "ecr_dkr" {
149149 vpc_id = var. vpc_id
150150}
151151
152- /* resource "aws_vpc_endpoint" "s3" { */
153- /* count = var.internal ? 1 : 0 */
154- /* auto_accept = true */
155- /* route_table_ids = var.route_table_ids */
156- /* service_name = "com.amazonaws.${var.region}.s3" */
157- /* tags = module.label.tags */
158- /* vpc_id = var.vpc_id */
159- /* } */
160-
161152resource "aws_vpc_endpoint" "s3" {
162153 count = var. internal ? 1 : 0
163154 auto_accept = true
164- security_group_ids = [ aws_security_group . vpc_endpoints . id ]
155+ route_table_ids = var . route_table_ids
165156 service_name = " com.amazonaws.${ var . region } .s3"
166- subnet_ids = var. private_subnet_ids
167157 tags = module. label . tags
168- vpc_endpoint_type = " Interface"
169158 vpc_id = var. vpc_id
170159}
171160
172161resource "aws_vpc_endpoint" "ssm" {
173- count = var. internal ? 1 : 0
174- auto_accept = true
162+ count = var. internal ? 1 : 0
163+ auto_accept = true
175164 private_dns_enabled = true
176165 security_group_ids = [aws_security_group . vpc_endpoints . id ]
177- service_name = " com.amazonaws.${ var . region } .ssm"
166+ service_name = " com.amazonaws.${ var . region } .ssm"
178167 subnet_ids = var. private_subnet_ids
179- tags = module. label . tags
168+ tags = module. label . tags
180169 vpc_endpoint_type = " Interface"
181- vpc_id = var. vpc_id
170+ vpc_id = var. vpc_id
182171}
183172
184173resource "aws_vpc_endpoint" "ssm_messages" {
185- count = var. internal ? 1 : 0
186- auto_accept = true
174+ count = var. internal ? 1 : 0
175+ auto_accept = true
187176 private_dns_enabled = true
188177 security_group_ids = [aws_security_group . vpc_endpoints . id ]
189- service_name = " com.amazonaws.${ var . region } .ssmmessages"
178+ service_name = " com.amazonaws.${ var . region } .ssmmessages"
190179 subnet_ids = var. private_subnet_ids
191- tags = module. label . tags
180+ tags = module. label . tags
192181 vpc_endpoint_type = " Interface"
193- vpc_id = var. vpc_id
182+ vpc_id = var. vpc_id
194183}
195184
196185resource "aws_security_group" "vpc_endpoints" {
@@ -199,11 +188,11 @@ resource "aws_security_group" "vpc_endpoints" {
199188 vpc_id = var. vpc_id
200189
201190 ingress {
202- description = " TLS from VPC"
203- from_port = 443
204- to_port = 443
205- protocol = " tcp"
206- cidr_blocks = var . private_subnet_cidrs
191+ description = " TLS from VPC"
192+ from_port = 443
193+ to_port = 443
194+ protocol = " tcp"
195+ security_groups = [ module . ecs . service_security_group_id ]
207196 }
208197
209198 egress {
0 commit comments