Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added support s3 endpoints #202

Merged
merged 8 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ data "aws_sqs_queue" "file_storage" {
count = local.use_internal_queue ? 0 : 1
depends_on = [module.file_storage]
name = local.bucket_queue_name
}
}

data "aws_region" "current" { }
9 changes: 9 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ locals {
network_database_subnet_group_name = var.create_vpc ? module.networking.database_subnet_group_name : "${var.namespace}-database-subnet"
}

module "s3_endpoint" {
count = length(var.private_link_allowed_account_ids) > 0 ? 1 : 0
source = "./modules/endpoint"
service_name = "com.amazonaws.${data.aws_region.current.name}.s3"
network_id = local.network_id
private_route_table_id = [module.networking.private_route_table_ids[0],module.networking.private_route_table_ids[1]]
amanpruthi marked this conversation as resolved.
Show resolved Hide resolved
depends_on = [module.networking]
}

module "database" {
source = "./modules/database"

Expand Down
21 changes: 21 additions & 0 deletions modules/endpoint/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
resource "aws_vpc_endpoint" "endpoint" {
jsbroks marked this conversation as resolved.
Show resolved Hide resolved
vpc_id = var.network_id
service_name = var.service_name
vpc_endpoint_type = "Gateway"
auto_accept = true
route_table_ids = var.private_route_table_id

policy = <<POLICY
{
"Version": "2008-10-17",
"Statement": [
{
"Action": "*",
"Effect": "Allow",
"Resource": "*",
"Principal": "*"
}
]
}
POLICY
}
Empty file added modules/endpoint/outputs.tf
Empty file.
14 changes: 14 additions & 0 deletions modules/endpoint/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
variable "network_id" {
type = string
description = "ID of the network (VPC) where infrastructure resources will be deployed."
}

variable "private_route_table_id" {
type = list(string)
description = "Private route table ID within the specified network (VPC) where resources will be deployed"
}

variable "service_name" {
type = string
description = "Name of the service or vpc endpoint"
}
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -439,4 +439,4 @@ variable "parquet_wandb_env" {
type = map(string)
description = "Extra environment variables for W&B"
default = {}
}
}
Loading