Skip to content

Commit 81f60d3

Browse files
authored
feat: Add intra subnet VPN route propagation (terraform-aws-modules#421)
1 parent 88d2c3c commit 81f60d3

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
457457
| private\_subnet\_suffix | Suffix to append to private subnets name | `string` | `"private"` | no |
458458
| private\_subnet\_tags | Additional tags for the private subnets | `map(string)` | `{}` | no |
459459
| private\_subnets | A list of private subnets inside the VPC | `list(string)` | `[]` | no |
460+
| propagate\_intra\_route\_tables\_vgw | Should be true if you want route table propagation | `bool` | `false` | no |
460461
| propagate\_private\_route\_tables\_vgw | Should be true if you want route table propagation | `bool` | `false` | no |
461462
| propagate\_public\_route\_tables\_vgw | Should be true if you want route table propagation | `bool` | `false` | no |
462463
| public\_acl\_tags | Additional tags for the public subnets network ACL | `map(string)` | `{}` | no |

main.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,19 @@ resource "aws_vpn_gateway_route_propagation" "private" {
10661066
)
10671067
}
10681068

1069+
resource "aws_vpn_gateway_route_propagation" "intra" {
1070+
count = var.create_vpc && var.propagate_intra_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != "") ? length(var.intra_subnets) : 0
1071+
1072+
route_table_id = element(aws_route_table.intra.*.id, count.index)
1073+
vpn_gateway_id = element(
1074+
concat(
1075+
aws_vpn_gateway.this.*.id,
1076+
aws_vpn_gateway_attachment.this.*.vpn_gateway_id,
1077+
),
1078+
count.index,
1079+
)
1080+
}
1081+
10691082
###########
10701083
# Defaults
10711084
###########

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,12 @@ variable "vpn_gateway_az" {
13331333
default = null
13341334
}
13351335

1336+
variable "propagate_intra_route_tables_vgw" {
1337+
description = "Should be true if you want route table propagation"
1338+
type = bool
1339+
default = false
1340+
}
1341+
13361342
variable "propagate_private_route_tables_vgw" {
13371343
description = "Should be true if you want route table propagation"
13381344
type = bool

0 commit comments

Comments
 (0)