VPNTunnelArgs

data class VPNTunnelArgs(val description: Output<String>? = null, val ikeVersion: Output<Int>? = null, val labels: Output<Map<String, String>>? = null, val localTrafficSelectors: Output<List<String>>? = null, val name: Output<String>? = null, val peerExternalGateway: Output<String>? = null, val peerExternalGatewayInterface: Output<Int>? = null, val peerGcpGateway: Output<String>? = null, val peerIp: Output<String>? = null, val project: Output<String>? = null, val region: Output<String>? = null, val remoteTrafficSelectors: Output<List<String>>? = null, val router: Output<String>? = null, val sharedSecret: Output<String>? = null, val targetVpnGateway: Output<String>? = null, val vpnGateway: Output<String>? = null, val vpnGatewayInterface: Output<Int>? = null) : ConvertibleToJava<VPNTunnelArgs>

VPN tunnel resource. To get more information about VpnTunnel, see:

Warning: All arguments including shared_secret will be stored in the raw state as plain-text.

Example Usage

Vpn Tunnel Basic

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.compute.VPNGateway;
import com.pulumi.gcp.compute.VPNGatewayArgs;
import com.pulumi.gcp.compute.Address;
import com.pulumi.gcp.compute.ForwardingRule;
import com.pulumi.gcp.compute.ForwardingRuleArgs;
import com.pulumi.gcp.compute.VPNTunnel;
import com.pulumi.gcp.compute.VPNTunnelArgs;
import com.pulumi.gcp.compute.Route;
import com.pulumi.gcp.compute.RouteArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var network1 = new Network("network1");
var targetGateway = new VPNGateway("targetGateway", VPNGatewayArgs.builder()
.network(network1.id())
.build());
var vpnStaticIp = new Address("vpnStaticIp");
var frEsp = new ForwardingRule("frEsp", ForwardingRuleArgs.builder()
.ipProtocol("ESP")
.ipAddress(vpnStaticIp.address())
.target(targetGateway.id())
.build());
var frUdp500 = new ForwardingRule("frUdp500", ForwardingRuleArgs.builder()
.ipProtocol("UDP")
.portRange("500")
.ipAddress(vpnStaticIp.address())
.target(targetGateway.id())
.build());
var frUdp4500 = new ForwardingRule("frUdp4500", ForwardingRuleArgs.builder()
.ipProtocol("UDP")
.portRange("4500")
.ipAddress(vpnStaticIp.address())
.target(targetGateway.id())
.build());
var tunnel1 = new VPNTunnel("tunnel1", VPNTunnelArgs.builder()
.peerIp("15.0.0.120")
.sharedSecret("a secret message")
.targetVpnGateway(targetGateway.id())
.build(), CustomResourceOptions.builder()
.dependsOn(
frEsp,
frUdp500,
frUdp4500)
.build());
var route1 = new Route("route1", RouteArgs.builder()
.network(network1.name())
.destRange("15.0.0.0/24")
.priority(1000)
.nextHopVpnTunnel(tunnel1.id())
.build());
}
}

Vpn Tunnel Beta

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.compute.NetworkArgs;
import com.pulumi.gcp.compute.VPNGateway;
import com.pulumi.gcp.compute.VPNGatewayArgs;
import com.pulumi.gcp.compute.Address;
import com.pulumi.gcp.compute.AddressArgs;
import com.pulumi.gcp.compute.ForwardingRule;
import com.pulumi.gcp.compute.ForwardingRuleArgs;
import com.pulumi.gcp.compute.VPNTunnel;
import com.pulumi.gcp.compute.VPNTunnelArgs;
import com.pulumi.gcp.compute.Route;
import com.pulumi.gcp.compute.RouteArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var network1 = new Network("network1", NetworkArgs.Empty, CustomResourceOptions.builder()
.provider(google_beta)
.build());
var targetGateway = new VPNGateway("targetGateway", VPNGatewayArgs.builder()
.network(network1.id())
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
var vpnStaticIp = new Address("vpnStaticIp", AddressArgs.Empty, CustomResourceOptions.builder()
.provider(google_beta)
.build());
var frEsp = new ForwardingRule("frEsp", ForwardingRuleArgs.builder()
.ipProtocol("ESP")
.ipAddress(vpnStaticIp.address())
.target(targetGateway.id())
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
var frUdp500 = new ForwardingRule("frUdp500", ForwardingRuleArgs.builder()
.ipProtocol("UDP")
.portRange("500")
.ipAddress(vpnStaticIp.address())
.target(targetGateway.id())
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
var frUdp4500 = new ForwardingRule("frUdp4500", ForwardingRuleArgs.builder()
.ipProtocol("UDP")
.portRange("4500")
.ipAddress(vpnStaticIp.address())
.target(targetGateway.id())
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
var tunnel1 = new VPNTunnel("tunnel1", VPNTunnelArgs.builder()
.peerIp("15.0.0.120")
.sharedSecret("a secret message")
.targetVpnGateway(targetGateway.id())
.labels(Map.of("foo", "bar"))
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.dependsOn(
frEsp,
frUdp500,
frUdp4500)
.build());
var route1 = new Route("route1", RouteArgs.builder()
.network(network1.name())
.destRange("15.0.0.0/24")
.priority(1000)
.nextHopVpnTunnel(tunnel1.id())
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
}
}

Import

VpnTunnel can be imported using any of these accepted formats

$ pulumi import gcp:compute/vPNTunnel:VPNTunnel default projects/{{project}}/regions/{{region}}/vpnTunnels/{{name}}
$ pulumi import gcp:compute/vPNTunnel:VPNTunnel default {{project}}/{{region}}/{{name}}
$ pulumi import gcp:compute/vPNTunnel:VPNTunnel default {{region}}/{{name}}
$ pulumi import gcp:compute/vPNTunnel:VPNTunnel default {{name}}

Constructors

Link copied to clipboard
constructor(description: Output<String>? = null, ikeVersion: Output<Int>? = null, labels: Output<Map<String, String>>? = null, localTrafficSelectors: Output<List<String>>? = null, name: Output<String>? = null, peerExternalGateway: Output<String>? = null, peerExternalGatewayInterface: Output<Int>? = null, peerGcpGateway: Output<String>? = null, peerIp: Output<String>? = null, project: Output<String>? = null, region: Output<String>? = null, remoteTrafficSelectors: Output<List<String>>? = null, router: Output<String>? = null, sharedSecret: Output<String>? = null, targetVpnGateway: Output<String>? = null, vpnGateway: Output<String>? = null, vpnGatewayInterface: Output<Int>? = null)

Properties

Link copied to clipboard
val description: Output<String>? = null

An optional description of this resource.

Link copied to clipboard
val ikeVersion: Output<Int>? = null

IKE protocol version to use when establishing the VPN tunnel with peer VPN gateway. Acceptable IKE versions are 1 or 2. Default version is 2.

Link copied to clipboard
val labels: Output<Map<String, String>>? = null

Labels to apply to this VpnTunnel.

Link copied to clipboard
val localTrafficSelectors: Output<List<String>>? = null

Local traffic selector to use when establishing the VPN tunnel with peer VPN gateway. The value should be a CIDR formatted string, for example 192.168.0.0/16. The ranges should be disjoint. Only IPv4 is supported.

Link copied to clipboard
val name: Output<String>? = null

Name of the resource. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

Link copied to clipboard
val peerExternalGateway: Output<String>? = null

URL of the peer side external VPN gateway to which this VPN tunnel is connected.

Link copied to clipboard
val peerExternalGatewayInterface: Output<Int>? = null

The interface ID of the external VPN gateway to which this VPN tunnel is connected.

Link copied to clipboard
val peerGcpGateway: Output<String>? = null

URL of the peer side HA GCP VPN gateway to which this VPN tunnel is connected. If provided, the VPN tunnel will automatically use the same vpn_gateway_interface ID in the peer GCP VPN gateway. This field must reference a gcp.compute.HaVpnGateway resource.

Link copied to clipboard
val peerIp: Output<String>? = null

IP address of the peer VPN gateway. Only IPv4 is supported.

Link copied to clipboard
val project: Output<String>? = null

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Link copied to clipboard
val region: Output<String>? = null

The region where the tunnel is located. If unset, is set to the region of target_vpn_gateway.

Link copied to clipboard
val remoteTrafficSelectors: Output<List<String>>? = null

Remote traffic selector to use when establishing the VPN tunnel with peer VPN gateway. The value should be a CIDR formatted string, for example 192.168.0.0/16. The ranges should be disjoint. Only IPv4 is supported.

Link copied to clipboard
val router: Output<String>? = null

URL of router resource to be used for dynamic routing.

Link copied to clipboard
val sharedSecret: Output<String>? = null

Shared secret used to set the secure session between the Cloud VPN gateway and the peer VPN gateway. Note: This property is sensitive and will not be displayed in the plan.

Link copied to clipboard
val targetVpnGateway: Output<String>? = null

URL of the Target VPN gateway with which this VPN tunnel is associated.

Link copied to clipboard
val vpnGateway: Output<String>? = null

URL of the VPN gateway with which this VPN tunnel is associated. This must be used if a High Availability VPN gateway resource is created. This field must reference a gcp.compute.HaVpnGateway resource.

Link copied to clipboard
val vpnGatewayInterface: Output<Int>? = null

The interface ID of the VPN gateway with which this VPN tunnel is associated.

Functions

Link copied to clipboard
open override fun toJava(): VPNTunnelArgs