Skip to content

Repository files navigation

terraform-google-vpn

Reusable Terraform module for Google Cloud VPN gateway and tunnel resources.

Overview

This module provisions Google Cloud VPN gateways and tunnels for GCP. It supports single VPN gateway, HA VPN gateway, external VPN gateway peers, and configurable tunnel definitions.

Usage

See examples/simple.tf and examples/full.tf for usage patterns.

Requirements

Name Version
google ~> 6

Providers

Name Version
google 6.15.0

Modules

No modules.

Resources

Name Type
google_compute_external_vpn_gateway.main resource
google_compute_ha_vpn_gateway.main resource
google_compute_vpn_gateway.main resource
google_compute_vpn_tunnel.main resource

Inputs

Name Description Type Default Required
external_vpn_gateway_interface A list of interface for the External VPN Gateway.
list(object({
id = optional(number)
ip_address = optional(string)
}))
null no
external_vpn_gateway_labels A map of labels for the External VPN Gateway. map(string) null no
external_vpn_gateway_name The name for the External VPN Gateway. string null no
external_vpn_gateway_redundancy_type The redundancy type for the External VPN Gateway. string "SINGLE_IP_INTERNALLY_REDUNDANT" no
gateway_ip_version The IP version for the VPN Gateway. string "IPV4" no
ha_vpn_gateway_name The name for the VPN Gateway. string null no
ha_vpn_interfaces A list of VPN interfaces for the VPN Gateway.
list(object({
id = optional(number)
interconnect_attachment = optional(string)
}))
[] no
ha_vpn_stack_type The stack type for the VPN Gateway. string "IPV4_ONLY" no
network The network for the VPN Gateway. string n/a yes
project The project for the VPN Gateway. string n/a yes
region The region for the VPN Gateway. string n/a yes
remote_router_self_link The self link for the remote router. string null no
vpn_gateway_description A description for the VPN Gateway. string null no
vpn_gateway_name The name for the VPN Gateway. string null no
vpn_tunnel The VPN Tunnel(s) for the VPN Gateway.
map(object({
shared_secret = optional(string)
description = optional(string)
target_vpn_gateway = optional(string)
vpn_gateway = optional(string)
vpn_gateway_interface = optional(number)
peer_external_gateway = optional(string)
peer_external_gateway_interface = optional(number)
peer_gcp_gateway = optional(string)
router = optional(string)
peer_ip = optional(string)
ike_version = optional(string)
local_traffic_selector = optional(list(string))
remote_traffic_selector = optional(list(string))
labels = optional(map(string))
region = optional(string)
project = optional(string)
}))
{} no

Outputs

Name Description
external_vpn_gateway The created External VPN Gateway resource
ha_vpn_gateway The created HA VPN Gateway resource
vpn_gateway The created VPN Gateway resource
vpn_tunnels The created VPN Tunnels

About

Terraform module sets up a VPN infrastructure on Google Cloud Platform (GCP). It supports the creation of Classic VPN Gateways, HA VPN Gateways, and External VPN Gateways, along with their respective VPN tunnels. The module is highly configurable, allowing you to specify various parameters such as project, region, network, and VPN tunnel details.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Contributors

Languages