VPNGateway Args
Represents a VPN gateway running in GCP. This virtual device is managed by Google, but used only by you. To get more information about VpnGateway, see:
Warning: Classic VPN is deprecating certain functionality on October 31, 2021. For more information, see the Classic VPN partial deprecation page.
Example Usage
Target Vpn Gateway 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());
}
}
Import
VpnGateway can be imported using any of these accepted formats
$ pulumi import gcp:compute/vPNGateway:VPNGateway default projects/{{project}}/regions/{{region}}/targetVpnGateways/{{name}}
$ pulumi import gcp:compute/vPNGateway:VPNGateway default {{project}}/{{region}}/{{name}}
$ pulumi import gcp:compute/vPNGateway:VPNGateway default {{region}}/{{name}}
$ pulumi import gcp:compute/vPNGateway:VPNGateway default {{name}}
Constructors
Properties
An optional description of this resource.
Name of the resource. Provided by the client when the resource is created. 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.