From ba5f0ab2c6cb19f743f187837660fb06abb6e237 Mon Sep 17 00:00:00 2001 From: badra001 Date: Mon, 17 Oct 2022 12:58:22 -0400 Subject: [PATCH] fix routing --- vpc-transit-gateway-association-data/README.md | 1 + vpc-transit-gateway-association-data/variables.tf | 5 +++++ vpc-transit-gateway-association/README.md | 1 + vpc-transit-gateway-association/routing.tf | 2 +- vpc-transit-gateway-association/variables.tf | 5 +++++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/vpc-transit-gateway-association-data/README.md b/vpc-transit-gateway-association-data/README.md index ffde32d..1a3c765 100644 --- a/vpc-transit-gateway-association-data/README.md +++ b/vpc-transit-gateway-association-data/README.md @@ -70,6 +70,7 @@ No modules. | [create](#input\_create) | Flag to indicate whether to create the resources or not (default: true) | `bool` | `true` | no | | [network\_account\_profile](#input\_network\_account\_profile) | AWS profile of the source account sharing the VPC resources | `string` | n/a | yes | | [override\_prefixes](#input\_override\_prefixes) | Override built-in prefixes by component. This should be used primarily for common infrastructure things | `map(string)` | `{}` | no | +| [private\_route\_table\_ids](#input\_private\_route\_table\_ids) | Map of private route table IDs (which exclude the attachment subnets) | `map(string)` | `{}` | no | | [private\_subnets\_ids](#input\_private\_subnets\_ids) | List of private subnet objects including: subnet, label, availability\_zone, id |
list(object({
subnet = string
label = string
availability_zone = string
id = string
}))
| `[]` | no | | [route\_prefix\_list\_name](#input\_route\_prefix\_list\_name) | Shared prefix list name used for routing to TGW. It is comprised of all of the network CIDR blocks in AWS using TGW. | `string` | `"transit-gateway.prod"` | no | | [route\_table\_label](#input\_route\_table\_label) | Route table lable for the attachment subnets | `string` | `"attachment"` | no | diff --git a/vpc-transit-gateway-association-data/variables.tf b/vpc-transit-gateway-association-data/variables.tf index d1c1568..fe85c1a 100644 --- a/vpc-transit-gateway-association-data/variables.tf +++ b/vpc-transit-gateway-association-data/variables.tf @@ -46,3 +46,8 @@ variable "transit_gateway_label" { ## type = list(string) ## } +variable "private_route_table_ids" { + description = "Map of private route table IDs (which exclude the attachment subnets)" + type = map(string) + default = {} +} diff --git a/vpc-transit-gateway-association/README.md b/vpc-transit-gateway-association/README.md index cdccdd6..a18e242 100644 --- a/vpc-transit-gateway-association/README.md +++ b/vpc-transit-gateway-association/README.md @@ -75,6 +75,7 @@ This sets up the necessary transit gateway configuration for attaching a VPC wit | [data\_input](#input\_data\_input) | Map of data generated by vpc-transit-gateway-association-data |
object({
availablity_zone = map(any)
gateway_self = string
gateway_peer = string
route_tables_self = map(any)
route_tables_peer = map(any)
map_route_tables_self = map(any)
map_route_tables_peer = map(any)
prefix_list_id_ipv4 = string
})
| n/a | yes | | [network\_account\_profile](#input\_network\_account\_profile) | AWS profile of the source account sharing the VPC resources | `string` | n/a | yes | | [override\_prefixes](#input\_override\_prefixes) | Override built-in prefixes by component. This should be used primarily for common infrastructure things | `map(string)` | `{}` | no | +| [private\_route\_table\_ids](#input\_private\_route\_table\_ids) | Map of private route table IDs (which exclude the attachment subnets) | `map(string)` | `{}` | no | | [private\_subnets\_ids](#input\_private\_subnets\_ids) | List of private subnet objects including: subnet, label, availability\_zone, id |
list(object({
subnet = string
label = string
availability_zone = string
id = string
}))
| `[]` | no | | [route\_prefix\_list\_name](#input\_route\_prefix\_list\_name) | Shared prefix list name used for routing to TGW. It is comprised of all of the network CIDR blocks in AWS using TGW. | `string` | `"transit-gateway.prod"` | no | | [route\_table\_label](#input\_route\_table\_label) | Route table lable for the attachment subnets | `string` | `"attachment"` | no | diff --git a/vpc-transit-gateway-association/routing.tf b/vpc-transit-gateway-association/routing.tf index 5e17f76..83e73ef 100644 --- a/vpc-transit-gateway-association/routing.tf +++ b/vpc-transit-gateway-association/routing.tf @@ -45,7 +45,7 @@ resource "null_resource" "vpc_attachment_exists" { # pick the first prefix list found, either NAME or NAME.ipv4 resource "aws_route" "gateway_ipv4" { - for_each = var.transit_gateway_routing_type == "self" ? module.routing_attachment_ipv4[0].private_route_table_ids : {} + for_each = var.transit_gateway_routing_type == "self" ? var.private_route_table_ids : {} route_table_id = each.value # destination_cidr_block = "10.128.0.0/16" diff --git a/vpc-transit-gateway-association/variables.tf b/vpc-transit-gateway-association/variables.tf index d1c1568..fe85c1a 100644 --- a/vpc-transit-gateway-association/variables.tf +++ b/vpc-transit-gateway-association/variables.tf @@ -46,3 +46,8 @@ variable "transit_gateway_label" { ## type = list(string) ## } +variable "private_route_table_ids" { + description = "Map of private route table IDs (which exclude the attachment subnets)" + type = map(string) + default = {} +}