Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ resource "aws_route" "requestor" {
depends_on = [data.aws_route_tables.requestor, aws_vpc_peering_connection.default]
}

# Create IPv6 routes from requestor to acceptor
resource "aws_route" "requestor_ipv6" {
count = module.this.enabled ? length(distinct(sort(data.aws_route_tables.requestor[0].ids))) : 0
route_table_id = element(distinct(sort(data.aws_route_tables.requestor[0].ids)), ceil(count.index))
destination_ipv6_cidr_block = data.aws_vpc.acceptor[0].ipv6_cidr_block
vpc_peering_connection_id = join("", aws_vpc_peering_connection.default[*].id)
depends_on = [data.aws_route_tables.requestor, aws_vpc_peering_connection.default]
}

# Create routes from acceptor to requestor
resource "aws_route" "acceptor" {
count = module.this.enabled ? length(distinct(sort(data.aws_route_tables.acceptor[0].ids))) * length(local.requestor_cidr_blocks) : 0
Expand All @@ -74,3 +83,12 @@ resource "aws_route" "acceptor" {
vpc_peering_connection_id = join("", aws_vpc_peering_connection.default[*].id)
depends_on = [data.aws_route_tables.acceptor, aws_vpc_peering_connection.default]
}

# Create IPv6 routes from acceptor to requestor
resource "aws_route" "acceptor_ipv6" {
count = module.this.enabled ? length(distinct(sort(data.aws_route_tables.acceptor[0].ids))) : 0
route_table_id = element(distinct(sort(data.aws_route_tables.acceptor[0].ids)), ceil(count.index))
destination_ipv6_cidr_block = data.aws_vpc.requestor[0].ipv6_cidr_block
vpc_peering_connection_id = join("", aws_vpc_peering_connection.default[*].id)
depends_on = [data.aws_route_tables.acceptor, aws_vpc_peering_connection.default]
}