Skip to content

Commit 63057b9

Browse files
Making ipsec PSK length configurable
1 parent 29b8ed3 commit 63057b9

File tree

6 files changed

+16
-2
lines changed

6 files changed

+16
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ References the variable descriptions below to determine the right configuration.
9797
| cr\_name | The name of cloud router for BGP routing | `string` | `""` | no |
9898
| gateway\_name | The name of VPN gateway | `string` | `"test-vpn"` | no |
9999
| ike\_version | Please enter the IKE version used by this tunnel (default is IKEv2) | `number` | `2` | no |
100+
| ipsec\_secret\_length | The lnegth the of shared secret for VPN tunnels | `number` | `8` | no |
100101
| local\_traffic\_selector | Local traffic selector to use when establishing the VPN tunnel with peer VPN gateway.<br>Value should be list of CIDR formatted strings and ranges should be disjoint. | `list(string)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
101102
| network | The name of VPC being created | `string` | n/a | yes |
102103
| peer\_asn | Please enter the ASN of the BGP peer that cloud router will use | `list(string)` | <pre>[<br> "65101"<br>]</pre> | no |

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+
| ipsec\_secret\_length | The lnegth the of shared secret for VPN tunnels | `number` | `8` | no |
271272
| keepalive\_interval | The interval in seconds between BGP keepalive messages that are sent to the peer. | `number` | `20` | no |
272273
| labels | Labels for vpn components | `map(string)` | `{}` | no |
273274
| name | VPN gateway name, and prefix used for dependent resources. | `string` | n/a | yes |

modules/vpn_ha/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,5 @@ resource "google_compute_vpn_tunnel" "tunnels" {
167167
}
168168

169169
resource "random_id" "secret" {
170-
byte_length = 8
170+
byte_length = var.ipsec_secret_length
171171
}

modules/vpn_ha/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,9 @@ variable "external_vpn_gateway_description" {
141141
type = string
142142
default = "Terraform managed external VPN gateway"
143143
}
144+
145+
variable "ipsec_secret_length" {
146+
type = number
147+
description = "The lnegth the of shared secret for VPN tunnels"
148+
default = 8
149+
}

tunnel.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
# Creating the VPN tunnel
1818
resource "random_id" "ipsec_secret" {
19-
byte_length = 8
19+
byte_length = var.ipsec_secret_length
2020
}
2121

2222
resource "google_compute_vpn_tunnel" "tunnel-static" {

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,9 @@ variable "route_tags" {
145145
description = "A list of instance tags to which this route applies."
146146
default = []
147147
}
148+
149+
variable "ipsec_secret_length" {
150+
type = number
151+
description = "The lnegth the of shared secret for VPN tunnels"
152+
default = 8
153+
}

0 commit comments

Comments
 (0)