From 43cbd3f095866b9dcf04bfaa046d764fc41d0913 Mon Sep 17 00:00:00 2001 From: PePe Amengual Date: Mon, 16 Oct 2023 16:37:51 -0700 Subject: [PATCH 1/3] fixing VPC endpoints for v5 --- components/terraform/aws/vpc/vpc-endpoints.tf | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/components/terraform/aws/vpc/vpc-endpoints.tf b/components/terraform/aws/vpc/vpc-endpoints.tf index 93d02e2a..9b137641 100644 --- a/components/terraform/aws/vpc/vpc-endpoints.tf +++ b/components/terraform/aws/vpc/vpc-endpoints.tf @@ -1,5 +1,6 @@ locals { 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" @@ -16,10 +17,12 @@ locals { }, ] }) + route_table_ids = local.route_tables } "dynamodb" = { name = "dynamodb" policy = null + route_table_ids = local.route_tables } } interface_vpc_endpoints = { @@ -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 -} From 49f8283a7b0c202677ff275d0591133ac6e1fe71 Mon Sep 17 00:00:00 2001 From: PePe Amengual Date: Tue, 17 Oct 2023 11:00:04 -0700 Subject: [PATCH 2/3] Update components/terraform/aws/vpc/vpc-endpoints.tf Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- components/terraform/aws/vpc/vpc-endpoints.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/terraform/aws/vpc/vpc-endpoints.tf b/components/terraform/aws/vpc/vpc-endpoints.tf index 9b137641..2f778932 100644 --- a/components/terraform/aws/vpc/vpc-endpoints.tf +++ b/components/terraform/aws/vpc/vpc-endpoints.tf @@ -1,5 +1,5 @@ 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" = { From 0be871c7b8014f8603f0330bac6150f0ddf87e4c Mon Sep 17 00:00:00 2001 From: PePe Amengual Date: Tue, 17 Oct 2023 11:00:16 -0700 Subject: [PATCH 3/3] Update components/terraform/aws/vpc/vpc-endpoints.tf Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- components/terraform/aws/vpc/vpc-endpoints.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/terraform/aws/vpc/vpc-endpoints.tf b/components/terraform/aws/vpc/vpc-endpoints.tf index 2f778932..a186132a 100644 --- a/components/terraform/aws/vpc/vpc-endpoints.tf +++ b/components/terraform/aws/vpc/vpc-endpoints.tf @@ -20,8 +20,8 @@ locals { route_table_ids = local.route_tables } "dynamodb" = { - name = "dynamodb" - policy = null + name = "dynamodb" + policy = null route_table_ids = local.route_tables } }