Skip to content

Commit

Permalink
Updates to vpc and vpc endpoints
Browse files Browse the repository at this point in the history
- fix vpc endpoints with enabling private dns
- add s3 gateway endpoint which is free
  • Loading branch information
marcincuber authored Nov 14, 2024
1 parent 328573a commit 6d0c49f
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions terraform/vpc.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "vpc_eks" {
source = "terraform-aws-modules/vpc/aws"
version = "5.8.1"
version = "5.15.0"

name = var.name_prefix

Expand Down Expand Up @@ -45,7 +45,7 @@ resource "aws_vpc_endpoint" "eks_vpc_ecr_dkr" {

security_group_ids = [aws_security_group.eks_vpc_endpoint.id]
subnet_ids = module.vpc_eks.private_subnets
private_dns_enabled = false
private_dns_enabled = true

tags = {
Name = "${var.name_prefix}-ecr-dkr"
Expand All @@ -59,7 +59,7 @@ resource "aws_vpc_endpoint" "eks_vpc_sts" {

security_group_ids = [aws_security_group.eks_vpc_endpoint.id]
subnet_ids = module.vpc_eks.private_subnets
private_dns_enabled = false
private_dns_enabled = true

tags = {
Name = "${var.name_prefix}-sts"
Expand All @@ -73,10 +73,21 @@ resource "aws_vpc_endpoint" "eks_vpc_s3" {

security_group_ids = [aws_security_group.eks_vpc_endpoint.id]
subnet_ids = module.vpc_eks.private_subnets
private_dns_enabled = false
private_dns_enabled = true

tags = {
Name = "${var.name_prefix}-s3"
Name = "${var.name_prefix}-s3-int"
}
}

resource "aws_vpc_endpoint" "eks_vpc_s3_gateway" {
vpc_id = module.vpc_eks.vpc_id
service_name = data.aws_vpc_endpoint_service.s3.service_name
route_table_ids = module.vpc_eks.private_route_table_ids
vpc_endpoint_type = "Gateway"

tags = {
Name = "${local.name_prefix_platform_vpc}-s3-gateway"
}
}

Expand All @@ -87,7 +98,7 @@ resource "aws_vpc_endpoint" "eks_vpc_aps_workspaces" {

security_group_ids = [aws_security_group.eks_vpc_endpoint.id]
subnet_ids = module.vpc_eks.private_subnets
private_dns_enabled = false
private_dns_enabled = true

policy = data.aws_iam_policy_document.eks_vpc_aps_workspaces.json

Expand Down

0 comments on commit 6d0c49f

Please sign in to comment.