From 4007b64d17df684c98bd7e8b42e3673221248257 Mon Sep 17 00:00:00 2001 From: badra001 Date: Fri, 21 Oct 2022 08:16:16 -0400 Subject: [PATCH] update cidr_block --- .../peer/README.md | 2 +- .../peer/associate.tf | 21 +++++++++++-------- .../self/routing.tf | 7 +++---- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/vpc-transit-gateway-association/peer/README.md b/vpc-transit-gateway-association/peer/README.md index b3ff8d0..2accc13 100644 --- a/vpc-transit-gateway-association/peer/README.md +++ b/vpc-transit-gateway-association/peer/README.md @@ -93,7 +93,7 @@ No modules. | [account\_id](#input\_account\_id) | AWS Account ID (default: will pull from current user) | `string` | `""` | no | | [availability\_zones](#input\_availability\_zones) | AWS Availability Zones to use (by default will use all available) | `list(string)` | `[]` | no | | [create](#input\_create) | Flag to indicate whether to create the resources or not (default: true) | `bool` | `true` | no | -| [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
vpn_prefix_list_id_ipv4 = string
})
| n/a | yes | +| [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)
map_vpn_route_tables_self = map(any)
map_vpn_route_tables_peer = map(any)
prefix_list_id_ipv4 = string
vpn_prefix_list_id_ipv4 = string
vpc_id = string
vpc_cidr_block = string
vpc_cidr_blocks = list(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 | diff --git a/vpc-transit-gateway-association/peer/associate.tf b/vpc-transit-gateway-association/peer/associate.tf index 4eb89a5..c253efb 100644 --- a/vpc-transit-gateway-association/peer/associate.tf +++ b/vpc-transit-gateway-association/peer/associate.tf @@ -10,9 +10,10 @@ locals { # add routes to peer for non-services #--- resource "aws_ec2_transit_gateway_route" "vpc_peer_own_rt" { - provider = aws.peer - for_each = { for k in local.selected_rt : k => local.transit_gateway_route_table_ids_peer[k] if k == var.transit_gateway_environment } - destination_cidr_block = data.aws_vpc.vpc.cidr_block + provider = aws.peer + for_each = { for k in local.selected_rt : k => local.transit_gateway_route_table_ids_peer[k] if k == var.transit_gateway_environment } + # destination_cidr_block = data.aws_vpc.vpc.cidr_block + destination_cidr_block = var.vpc_cidr_block transit_gateway_attachment_id = data.aws_ec2_transit_gateway_peering_attachment.attachment_peer.id transit_gateway_route_table_id = each.value @@ -22,9 +23,10 @@ resource "aws_ec2_transit_gateway_route" "vpc_peer_own_rt" { # always add routes to services #-- resource "aws_ec2_transit_gateway_route" "vpc_peer_common" { - provider = aws.peer - for_each = { "services" = local.transit_gateway_route_table_ids_peer["services"] } - destination_cidr_block = data.aws_vpc.vpc.cidr_block + provider = aws.peer + for_each = { "services" = local.transit_gateway_route_table_ids_peer["services"] } + # destination_cidr_block = data.aws_vpc.vpc.cidr_block + destination_cidr_block = var.vpc_cidr_block transit_gateway_attachment_id = data.aws_ec2_transit_gateway_peering_attachment.attachment_peer.id transit_gateway_route_table_id = each.value @@ -34,9 +36,10 @@ resource "aws_ec2_transit_gateway_route" "vpc_peer_common" { # if services, add routes to all other route tables #-- resource "aws_ec2_transit_gateway_route" "vpc_peer_all" { - provider = aws.peer - for_each = contains(local.propagate_all_rt, var.transit_gateway_environment) ? { for k in local.selected_rt : k => local.transit_gateway_route_table_ids_peer[k] } : {} - destination_cidr_block = data.aws_vpc.vpc.cidr_block + provider = aws.peer + for_each = contains(local.propagate_all_rt, var.transit_gateway_environment) ? { for k in local.selected_rt : k => local.transit_gateway_route_table_ids_peer[k] } : {} + # destination_cidr_block = data.aws_vpc.vpc.cidr_block + destination_cidr_block = var.vpc_cidr_block transit_gateway_attachment_id = data.aws_ec2_transit_gateway_peering_attachment.attachment_peer.id transit_gateway_route_table_id = each.value diff --git a/vpc-transit-gateway-association/self/routing.tf b/vpc-transit-gateway-association/self/routing.tf index a022375..45ddc2f 100644 --- a/vpc-transit-gateway-association/self/routing.tf +++ b/vpc-transit-gateway-association/self/routing.tf @@ -12,10 +12,9 @@ module "routing_attachment_ipv4" { enable_nat = false enable_vpc_endpoint_s3 = false enable_vpc_endpoint_dynamodb = false - - vpc_name = var.vpc_name - vpc_short_name = var.vpc_short_name - vpc_cidr_block = data.aws_vpc.vpc.cidr_block + vpc_name = var.vpc_name + vpc_short_name = var.vpc_short_name + vpc_cidr_block = var.vpc_cidr_block # vpc_index = var.vpc_index tags = merge(