Skip to content

Commit

Permalink
Supports configuring vpc routes to prefix list destinations
Browse files Browse the repository at this point in the history
  • Loading branch information
lorengordon committed Oct 7, 2024
1 parent 03b7393 commit 3f7fa3f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
5 changes: 3 additions & 2 deletions modules/cross-account-vpc-attachment/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ variable "vpc_routes" {
name = string
provider = string
route_table_id = string
destination_cidr_block = string
destination_ipv6_cidr_block = string
destination_cidr_block = optional(string)
destination_ipv6_cidr_block = optional(string)
destination_prefix_list_id = optional(string)
}))
default = []
validation {
Expand Down
1 change: 1 addition & 0 deletions modules/vpc-accepter/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ resource "aws_route" "this" {
route_table_id = each.value.route_table_id
destination_cidr_block = each.value.destination_cidr_block
destination_ipv6_cidr_block = each.value.destination_ipv6_cidr_block
destination_prefix_list_id = each.value.destination_prefix_list_id
transit_gateway_id = var.auto_accept_shared_attachments == "disable" ? aws_ec2_transit_gateway_vpc_attachment_accepter.this[0].transit_gateway_id : data.aws_ec2_transit_gateway_attachment.this[0].transit_gateway_id
}

Expand Down
5 changes: 3 additions & 2 deletions modules/vpc-accepter/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ variable "vpc_routes" {
# `name` is used as for_each key
name = string
route_table_id = string
destination_cidr_block = string
destination_ipv6_cidr_block = string
destination_cidr_block = optional(string)
destination_ipv6_cidr_block = optional(string)
destination_prefix_list_id = optional(string)
}))
default = []
}
1 change: 1 addition & 0 deletions modules/vpc-attachment/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ resource "aws_route" "this" {
route_table_id = each.value.route_table_id
destination_cidr_block = each.value.destination_cidr_block
destination_ipv6_cidr_block = each.value.destination_ipv6_cidr_block
destination_prefix_list_id = each.value.destination_prefix_list_id
transit_gateway_id = aws_ec2_transit_gateway_vpc_attachment.this.transit_gateway_id
}

Expand Down
5 changes: 3 additions & 2 deletions modules/vpc-attachment/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ variable "vpc_routes" {
# `name` is used as for_each key
name = string
route_table_id = string
destination_cidr_block = string
destination_ipv6_cidr_block = string
destination_cidr_block = optional(string)
destination_ipv6_cidr_block = optional(string)
destination_prefix_list_id = optional(string)
}))
default = []
}
9 changes: 5 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,14 @@ variable "vpc_attachments" {
dns_support = string
ipv6_support = string
tags = map(string)
vpc_routes = list(object({
vpc_routes = optional(list(object({
# `name` is used as for_each key
name = string
route_table_id = string
destination_cidr_block = string
destination_ipv6_cidr_block = string
}))
destination_cidr_block = optional(string)
destination_ipv6_cidr_block = optional(string)
destination_prefix_list_id = optional(string)
})), [])
transit_gateway_default_route_table_association = bool
transit_gateway_default_route_table_propagation = bool
# name from `route_tables` or id of a pre-existing route table
Expand Down

0 comments on commit 3f7fa3f

Please sign in to comment.