Skip to content

Commit

Permalink
Merge pull request #29 from controlshift/fix_vpc_endpoint_to_s3
Browse files Browse the repository at this point in the history
VPC endpoint must be associated with the subnet's route table
  • Loading branch information
anero authored Nov 17, 2021
2 parents 609afc4 + f6fd887 commit 41fcbb4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions glue_job.tf
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,19 @@ data "aws_vpc" "main" {
id = var.vpc_id
}

data "aws_route_tables" "all_route_tables" {
vpc_id = data.aws_vpc.main.id
}

# Glue jobs require a VPC endpoint for connecting to S3
resource "aws_vpc_endpoint" "s3" {
vpc_id = data.aws_vpc.main.id
service_name = "com.amazonaws.${var.aws_region}.s3"
}

resource "aws_vpc_endpoint_route_table_association" "s3" {
count = length(data.aws_route_tables.all_route_tables.ids)

route_table_id = tolist(data.aws_route_tables.all_route_tables.ids)[count.index]
vpc_endpoint_id = aws_vpc_endpoint.s3.id
}

0 comments on commit 41fcbb4

Please sign in to comment.