Skip to content

Commit

Permalink
Merge pull request #139 from slalombuild/v5_provider_vpc_fix
Browse files Browse the repository at this point in the history
fixing VPC endpoints for v5 aws provider
  • Loading branch information
davenicoll authored Oct 17, 2023
2 parents 4bf4209 + 0be871c commit e82c2a4
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions components/terraform/aws/vpc/vpc-endpoints.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
locals {
enabled = var.enable_vpc_endpoints
enabled = var.enable_vpc_endpoints
route_tables = concat(module.subnets.private_route_table_ids, module.subnets.public_route_table_ids)
gateway_vpc_endpoints = {
"s3" = {
name = "s3"
Expand All @@ -16,10 +17,12 @@ locals {
},
]
})
route_table_ids = local.route_tables
}
"dynamodb" = {
name = "dynamodb"
policy = null
name = "dynamodb"
policy = null
route_table_ids = local.route_tables
}
}
interface_vpc_endpoints = {
Expand Down Expand Up @@ -306,22 +309,3 @@ resource "aws_security_group" "ecr_dkr_vpc_endpoint_sg" {

tags = module.ecr_dkr_vpc_endpoint_sg_label.tags
}

/*
Endpoint route table association
*/

locals {
route_tables = concat(module.subnets.private_route_table_ids, module.subnets.public_route_table_ids)
}
resource "aws_vpc_endpoint_route_table_association" "s3_gateway_vpc_endpoint_route_table_association" {
count = local.enabled ? length(local.route_tables) : 0
route_table_id = local.route_tables[count.index]
vpc_endpoint_id = module.vpc_endpoints.gateway_vpc_endpoints[0].id
}

resource "aws_vpc_endpoint_route_table_association" "dynamodb_gateway_vpc_endpoint_route_table_association" {
count = local.enabled ? length(local.route_tables) : 0
route_table_id = local.route_tables[count.index]
vpc_endpoint_id = module.vpc_endpoints.gateway_vpc_endpoints[1].id
}

0 comments on commit e82c2a4

Please sign in to comment.