Skip to content

Commit 9f733b5

Browse files
committed
add interconnect support in HA VPN
Signed-off-by: Ricky Hariady <[email protected]>
1 parent f9d73d9 commit 9f733b5

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

modules/vpn_ha/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ module "vpn_ha" {
268268
|------|-------------|------|---------|:--------:|
269269
| create\_vpn\_gateway | create a VPN gateway | `bool` | `true` | no |
270270
| external\_vpn\_gateway\_description | An optional description of external VPN Gateway | `string` | `"Terraform managed external VPN gateway"` | no |
271+
| interconnect\_attachment | URL of the interconnect attachment resource. When the value of this field is present, the VPN Gateway will be used for IPsec-encrypted Cloud Interconnect. | `list(string)` | `[]` | no |
271272
| ipsec\_secret\_length | The lnegth the of shared secret for VPN tunnels | `number` | `8` | no |
272273
| keepalive\_interval | The interval in seconds between BGP keepalive messages that are sent to the peer. | `number` | `20` | no |
273274
| labels | Labels for vpn components | `map(string)` | `{}` | no |

modules/vpn_ha/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ resource "google_compute_ha_vpn_gateway" "ha_gateway" {
4242
network = var.network
4343
stack_type = var.stack_type
4444
labels = var.labels
45+
dynamic "vpn_interfaces" {
46+
for_each = { for idx, val in var.interconnect_attachment : idx => val }
47+
content {
48+
id = vpn_interfaces.key
49+
interconnect_attachment = vpn_interfaces.value
50+
}
51+
}
4552
}
4653

4754
resource "google_compute_external_vpn_gateway" "external_gateway" {

modules/vpn_ha/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ variable "stack_type" {
4444
default = "IPV4_ONLY"
4545
}
4646

47+
variable "interconnect_attachment" {
48+
description = "URL of the interconnect attachment resource. When the value of this field is present, the VPN Gateway will be used for IPsec-encrypted Cloud Interconnect."
49+
type = list(string)
50+
default = []
51+
}
52+
4753
variable "network" {
4854
description = "VPC used for the gateway and routes."
4955
type = string

0 commit comments

Comments
 (0)