net-vpn-ha (#3420)

This commit is contained in:
Ludovico Magnocavallo
2025-10-16 09:08:17 +02:00
committed by GitHub
parent ccecb0dd24
commit 45d4674ae8
6 changed files with 279 additions and 28 deletions

View File

@@ -0,0 +1,57 @@
context = {
addresses = {
test = "8.8.8.8"
}
locations = {
ew8 = "europe-west8"
}
networks = {
test = "projects/foo-dev-net-spoke-0/global/networks/dev-spoke-0"
}
project_ids = {
test = "foo-test-0"
}
routers = {
test = "vpn-to-onprem-ew8"
}
vpn_gateways = {
local = "projects/foo-prod-net-landing-0/regions/europe-west8/vpnGateways/vpn-to-onprem-ew8"
remote = "projects/foo-prod-net-landing-1/regions/europe-west8/vpnGateways/vpn-to-onprem-ew8"
}
}
project_id = "$project_ids:test"
network = "$networks:test"
region = "$locations:ew8"
name = "test"
router_config = {
asn = 64513
create = false
name = "$routers:test"
}
peer_gateways = {
default = {
gcp = "$vpn_gateways:remote"
}
}
tunnels = {
remote-0 = {
bgp_peer = {
address = "169.254.1.2"
asn = 64514
}
bgp_session_range = "169.254.1.1/30"
shared_secret = "foo"
vpn_gateway_interface = 0
}
remote-1 = {
bgp_peer = {
address = "169.254.2.2"
asn = 64514
}
bgp_session_range = "169.254.2.1/30"
shared_secret = "foo"
vpn_gateway_interface = 1
}
}
vpn_gateway = "$vpn_gateways:local"
vpn_gateway_create = null

View File

@@ -0,0 +1,143 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
values:
google_compute_router_interface.router_interface["remote-0"]:
interconnect_attachment: null
ip_range: 169.254.1.1/30
name: test-remote-0
private_ip_address: null
project: foo-test-0
region: europe-west8
router: vpn-to-onprem-ew8
subnetwork: null
timeouts: null
vpn_tunnel: test-remote-0
google_compute_router_interface.router_interface["remote-1"]:
interconnect_attachment: null
ip_range: 169.254.2.1/30
name: test-remote-1
private_ip_address: null
project: foo-test-0
region: europe-west8
router: vpn-to-onprem-ew8
subnetwork: null
timeouts: null
vpn_tunnel: test-remote-1
google_compute_router_peer.bgp_peer["remote-0"]:
advertise_mode: DEFAULT
advertised_groups: []
advertised_ip_ranges: []
advertised_route_priority: 1000
custom_learned_ip_ranges: []
custom_learned_route_priority: null
enable: true
enable_ipv6: false
export_policies: null
import_policies: null
interface: test-remote-0
md5_authentication_key: []
name: test-remote-0
peer_asn: 64514
peer_ip_address: 169.254.1.2
project: foo-test-0
region: europe-west8
router: vpn-to-onprem-ew8
router_appliance_instance: null
timeouts: null
zero_advertised_route_priority: null
zero_custom_learned_route_priority: false
google_compute_router_peer.bgp_peer["remote-1"]:
advertise_mode: DEFAULT
advertised_groups: []
advertised_ip_ranges: []
advertised_route_priority: 1000
custom_learned_ip_ranges: []
custom_learned_route_priority: null
enable: true
enable_ipv6: false
export_policies: null
import_policies: null
interface: test-remote-1
md5_authentication_key: []
name: test-remote-1
peer_asn: 64514
peer_ip_address: 169.254.2.2
project: foo-test-0
region: europe-west8
router: vpn-to-onprem-ew8
router_appliance_instance: null
timeouts: null
zero_advertised_route_priority: null
zero_custom_learned_route_priority: false
google_compute_vpn_tunnel.tunnels["remote-0"]:
description: null
effective_labels:
goog-terraform-provisioned: 'true'
ike_version: 2
labels: null
name: test-remote-0
peer_external_gateway: null
peer_external_gateway_interface: null
peer_gcp_gateway: projects/foo-prod-net-landing-1/regions/europe-west8/vpnGateways/vpn-to-onprem-ew8
project: foo-test-0
region: europe-west8
router: vpn-to-onprem-ew8
shared_secret: foo
target_vpn_gateway: null
terraform_labels:
goog-terraform-provisioned: 'true'
timeouts: null
vpn_gateway: projects/foo-prod-net-landing-0/regions/europe-west8/vpnGateways/vpn-to-onprem-ew8
vpn_gateway_interface: 0
google_compute_vpn_tunnel.tunnels["remote-1"]:
description: null
effective_labels:
goog-terraform-provisioned: 'true'
ike_version: 2
labels: null
name: test-remote-1
peer_external_gateway: null
peer_external_gateway_interface: null
peer_gcp_gateway: projects/foo-prod-net-landing-1/regions/europe-west8/vpnGateways/vpn-to-onprem-ew8
project: foo-test-0
region: europe-west8
router: vpn-to-onprem-ew8
shared_secret: foo
target_vpn_gateway: null
terraform_labels:
goog-terraform-provisioned: 'true'
timeouts: null
vpn_gateway: projects/foo-prod-net-landing-0/regions/europe-west8/vpnGateways/vpn-to-onprem-ew8
vpn_gateway_interface: 1
random_id.md5_keys["remote-0"]:
byte_length: 12
keepers: null
prefix: null
random_id.md5_keys["remote-1"]:
byte_length: 12
keepers: null
prefix: null
random_id.secret:
byte_length: 8
keepers: null
prefix: null
counts:
google_compute_router_interface: 2
google_compute_router_peer: 2
google_compute_vpn_tunnel: 2
modules: 0
random_id: 3
resources: 9

View File

@@ -0,0 +1,18 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
module: modules/net-vpn-ha
tests:
context: