Skip to content

Commit

Permalink
feat: Add intra subnet VPN route propagation (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrFaust92 authored Mar 24, 2020
1 parent 88d2c3c commit 81f60d3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
13 changes: 13 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
###########
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 81f60d3

Please sign in to comment.