Skip to content

Commit 0e5c558

Browse files
Added cipher_suite to VpnTunnel (#14248) (#23253)
[upstream:9335fd811c4c900701f70aa000d0e3b4192cee69] Signed-off-by: Modular Magician <[email protected]>
1 parent a2350fb commit 0e5c558

File tree

2 files changed

+147
-0
lines changed

2 files changed

+147
-0
lines changed

.changelog/14248.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
compute: added `cipher_suite` block with phase1 and phase2 encryption configurations to `google_compute_vpn_tunnel` resource.
3+
```

website/docs/r/compute_vpn_tunnel.html.markdown

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,100 @@ resource "google_compute_route" "route1" {
107107
next_hop_vpn_tunnel = google_compute_vpn_tunnel.tunnel1.id
108108
}
109109
```
110+
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
111+
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=vpn_tunnel_cipher_suite&open_in_editor=main.tf" target="_blank">
112+
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
113+
</a>
114+
</div>
115+
## Example Usage - Vpn Tunnel Cipher Suite
116+
117+
118+
```hcl
119+
resource "google_compute_vpn_tunnel" "tunnel1" {
120+
provider = google-beta
121+
name = "tunnel-cipher"
122+
peer_ip = "15.0.0.120"
123+
shared_secret = "a secret message"
124+
125+
target_vpn_gateway = google_compute_vpn_gateway.target_gateway.id
126+
127+
cipher_suite {
128+
phase1 {
129+
encryption = ["AES-CBC-256"]
130+
integrity = ["HMAC-SHA2-256-128"]
131+
prf = ["PRF-HMAC-SHA2-256"]
132+
dh = ["Group-14"]
133+
}
134+
phase2 {
135+
encryption = ["AES-CBC-128"]
136+
integrity = ["HMAC-SHA2-256-128"]
137+
pfs = ["Group-14"]
138+
}
139+
}
140+
141+
depends_on = [
142+
google_compute_forwarding_rule.fr_esp,
143+
google_compute_forwarding_rule.fr_udp500,
144+
google_compute_forwarding_rule.fr_udp4500,
145+
]
146+
147+
labels = {
148+
foo = "bar"
149+
}
150+
}
151+
152+
resource "google_compute_vpn_gateway" "target_gateway" {
153+
provider = google-beta
154+
name = "vpn-1"
155+
network = google_compute_network.network1.id
156+
}
157+
158+
resource "google_compute_network" "network1" {
159+
provider = google-beta
160+
name = "network-1"
161+
}
162+
163+
resource "google_compute_address" "vpn_static_ip" {
164+
provider = google-beta
165+
name = "vpn-static-ip"
166+
}
167+
168+
resource "google_compute_forwarding_rule" "fr_esp" {
169+
provider = google-beta
170+
name = "fr-esp"
171+
ip_protocol = "ESP"
172+
ip_address = google_compute_address.vpn_static_ip.address
173+
target = google_compute_vpn_gateway.target_gateway.id
174+
}
175+
176+
resource "google_compute_forwarding_rule" "fr_udp500" {
177+
provider = google-beta
178+
name = "fr-udp500"
179+
ip_protocol = "UDP"
180+
port_range = "500"
181+
ip_address = google_compute_address.vpn_static_ip.address
182+
target = google_compute_vpn_gateway.target_gateway.id
183+
}
184+
185+
resource "google_compute_forwarding_rule" "fr_udp4500" {
186+
provider = google-beta
187+
name = "fr-udp4500"
188+
ip_protocol = "UDP"
189+
port_range = "4500"
190+
ip_address = google_compute_address.vpn_static_ip.address
191+
target = google_compute_vpn_gateway.target_gateway.id
192+
}
193+
194+
resource "google_compute_route" "route1" {
195+
provider = google-beta
196+
name = "route1"
197+
network = google_compute_network.network1.name
198+
dest_range = "15.0.0.0/24"
199+
priority = 1000
200+
201+
next_hop_vpn_tunnel = google_compute_vpn_tunnel.tunnel1.id
202+
}
203+
```
110204

111205
## Argument Reference
112206

@@ -201,6 +295,11 @@ The following arguments are supported:
201295
**Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
202296
Please refer to the field `effective_labels` for all of the labels present on the resource.
203297

298+
* `cipher_suite` -
299+
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
300+
User specified list of ciphers to use for the phase 1 and phase 2 of the IKE protocol.
301+
Structure is [documented below](#nested_cipher_suite).
302+
204303
* `region` -
205304
(Optional)
206305
The region where the tunnel is located. If unset, is set to the region of `target_vpn_gateway`.
@@ -209,6 +308,51 @@ The following arguments are supported:
209308
If it is not provided, the provider project is used.
210309

211310

311+
<a name="nested_cipher_suite"></a>The `cipher_suite` block supports:
312+
313+
* `phase1` -
314+
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
315+
Cipher configuration for phase 1 of the IKE protocol.
316+
Structure is [documented below](#nested_cipher_suite_phase1).
317+
318+
* `phase2` -
319+
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
320+
Cipher configuration for phase 2 of the IKE protocol.
321+
Structure is [documented below](#nested_cipher_suite_phase2).
322+
323+
324+
<a name="nested_cipher_suite_phase1"></a>The `phase1` block supports:
325+
326+
* `encryption` -
327+
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
328+
Encryption algorithms.
329+
330+
* `integrity` -
331+
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
332+
Integrity algorithms.
333+
334+
* `prf` -
335+
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
336+
Pseudo-random functions.
337+
338+
* `dh` -
339+
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
340+
Diffie-Hellman groups.
341+
342+
<a name="nested_cipher_suite_phase2"></a>The `phase2` block supports:
343+
344+
* `encryption` -
345+
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
346+
Encryption algorithms.
347+
348+
* `integrity` -
349+
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
350+
Integrity algorithms.
351+
352+
* `pfs` -
353+
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
354+
Perfect forward secrecy groups.
355+
212356
## Attributes Reference
213357

214358
In addition to the arguments listed above, the following computed attributes are exported:

0 commit comments

Comments
 (0)