diff --git a/README.md b/README.md index 9ae48768d..c36104648 100644 --- a/README.md +++ b/README.md @@ -457,6 +457,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway | private\_subnet\_suffix | Suffix to append to private subnets name | `string` | `"private"` | no | | private\_subnet\_tags | Additional tags for the private subnets | `map(string)` | `{}` | no | | private\_subnets | A list of private subnets inside the VPC | `list(string)` | `[]` | no | +| propagate\_intra\_route\_tables\_vgw | Should be true if you want route table propagation | `bool` | `false` | no | | propagate\_private\_route\_tables\_vgw | Should be true if you want route table propagation | `bool` | `false` | no | | propagate\_public\_route\_tables\_vgw | Should be true if you want route table propagation | `bool` | `false` | no | | public\_acl\_tags | Additional tags for the public subnets network ACL | `map(string)` | `{}` | no | diff --git a/main.tf b/main.tf index 34c36ea45..30f8130a3 100644 --- a/main.tf +++ b/main.tf @@ -1066,6 +1066,19 @@ resource "aws_vpn_gateway_route_propagation" "private" { ) } +resource "aws_vpn_gateway_route_propagation" "intra" { + count = var.create_vpc && var.propagate_intra_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != "") ? length(var.intra_subnets) : 0 + + route_table_id = element(aws_route_table.intra.*.id, count.index) + vpn_gateway_id = element( + concat( + aws_vpn_gateway.this.*.id, + aws_vpn_gateway_attachment.this.*.vpn_gateway_id, + ), + count.index, + ) +} + ########### # Defaults ########### diff --git a/variables.tf b/variables.tf index 7a5cc4414..7b10f96f5 100644 --- a/variables.tf +++ b/variables.tf @@ -1333,6 +1333,12 @@ variable "vpn_gateway_az" { default = null } +variable "propagate_intra_route_tables_vgw" { + description = "Should be true if you want route table propagation" + type = bool + default = false +} + variable "propagate_private_route_tables_vgw" { description = "Should be true if you want route table propagation" type = bool