diff --git a/apps/infra/production/storage/s3_gateway_vpc_endpoint.tf b/apps/infra/production/storage/s3_gateway_vpc_endpoint.tf index cb5ba6a70d..4fba124dbc 100644 --- a/apps/infra/production/storage/s3_gateway_vpc_endpoint.tf +++ b/apps/infra/production/storage/s3_gateway_vpc_endpoint.tf @@ -1,8 +1,15 @@ +data "aws_route_table" "private" { + vpc_id = data.aws_vpc.main.id + tags = { + Name = "Codedang-Private-RT" + } +} + resource "aws_vpc_endpoint" "s3_endpoint" { - vpc_id = aws_vpc.main.id - service_name = "com.amazonaws.ap-northeast-2.s3" + vpc_id = data.aws_vpc.main.id + service_name = "com.amazonaws.${var.region}.s3" vpc_endpoint_type = "Gateway" - route_table_ids = [aws_route_table.private.id] + route_table_ids = [data.aws_route_table.private.id] policy = jsonencode({ Version = "2008-10-17" @@ -17,7 +24,7 @@ resource "aws_vpc_endpoint" "s3_endpoint" { }) tags = { - "Name" = "s3-endpoint" + "Name" = "S3-Gateway-Endpoint-for-Private-RT" } } diff --git a/apps/infra/production/storage/variables.tf b/apps/infra/production/storage/variables.tf index 7deb0f7eae..1562fe72b7 100644 --- a/apps/infra/production/storage/variables.tf +++ b/apps/infra/production/storage/variables.tf @@ -18,3 +18,10 @@ variable "redis_port" { default = 6379 sensitive = true } + +variable "region" { + type = string + description = "The region for provider" + default = "ap-northeast-2" +} +