Commit 81f60d33 authored by Ilia Lazebnik's avatar Ilia Lazebnik Committed by GitHub

feat: Add intra subnet VPN route propagation (#421)

parent 88d2c3c0
...@@ -457,6 +457,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway ...@@ -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\_suffix | Suffix to append to private subnets name | `string` | `"private"` | no |
| private\_subnet\_tags | Additional tags for the private subnets | `map(string)` | `{}` | 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 | | 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\_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 | | 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 | | public\_acl\_tags | Additional tags for the public subnets network ACL | `map(string)` | `{}` | no |
......
...@@ -1066,6 +1066,19 @@ resource "aws_vpn_gateway_route_propagation" "private" { ...@@ -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 # Defaults
########### ###########
......
...@@ -1333,6 +1333,12 @@ variable "vpn_gateway_az" { ...@@ -1333,6 +1333,12 @@ variable "vpn_gateway_az" {
default = null 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" { variable "propagate_private_route_tables_vgw" {
description = "Should be true if you want route table propagation" description = "Should be true if you want route table propagation"
type = bool type = bool
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment