Package com.pulumi.gcp.compute
Class VPNGateway
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.gcp.compute.VPNGateway
-
public class VPNGateway extends com.pulumi.resources.CustomResource
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: * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/targetVpnGateways) > **Warning:** Classic VPN is deprecating certain functionality on October 31, 2021. For more information, see the [Classic VPN partial deprecation page](https://cloud.google.com/network-connectivity/docs/vpn/deprecations/classic-vpn-deprecation). ## Example Usage ### Target Vpn Gateway Basic ```java 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* `projects/{{project}}/regions/{{region}}/targetVpnGateways/{{name}}` * `{{project}}/{{region}}/{{name}}` * `{{region}}/{{name}}` * `{{name}}` In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import VpnGateway using one of the formats above. For exampletf import { id = "projects/{{project}}/regions/{{region}}/targetVpnGateways/{{name}}" to = google_compute_vpn_gateway.default } ```sh $ pulumi import gcp:compute/vPNGateway:VPNGateway When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), VpnGateway can be imported using one of the formats above. For example ``` ```sh $ pulumi import gcp:compute/vPNGateway:VPNGateway default projects/{{project}}/regions/{{region}}/targetVpnGateways/{{name}} ``` ```sh $ pulumi import gcp:compute/vPNGateway:VPNGateway default {{project}}/{{region}}/{{name}} ``` ```sh $ pulumi import gcp:compute/vPNGateway:VPNGateway default {{region}}/{{name}} ``` ```sh $ pulumi import gcp:compute/vPNGateway:VPNGateway default {{name}} ```
-
-
Constructor Summary
Constructors Constructor Description VPNGateway(java.lang.String name)
VPNGateway(java.lang.String name, VPNGatewayArgs args)
VPNGateway(java.lang.String name, VPNGatewayArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.String>
creationTimestamp()
com.pulumi.core.Output<java.util.Optional<java.lang.String>>
description()
com.pulumi.core.Output<java.lang.Integer>
gatewayId()
static VPNGateway
get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, VPNGatewayState state, com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>
name()
com.pulumi.core.Output<java.lang.String>
network()
com.pulumi.core.Output<java.lang.String>
project()
com.pulumi.core.Output<java.lang.String>
region()
com.pulumi.core.Output<java.lang.String>
selfLink()
-
-
-
Constructor Detail
-
VPNGateway
public VPNGateway(java.lang.String name)
- Parameters:
name
- The _unique_ name of the resulting resource.
-
VPNGateway
public VPNGateway(java.lang.String name, VPNGatewayArgs args)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.
-
VPNGateway
public VPNGateway(java.lang.String name, VPNGatewayArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.options
- A bag of options that control this resource's behavior.
-
-
Method Detail
-
creationTimestamp
public com.pulumi.core.Output<java.lang.String> creationTimestamp()
- Returns:
- Creation timestamp in RFC3339 text format.
-
description
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()
- Returns:
- An optional description of this resource.
-
gatewayId
public com.pulumi.core.Output<java.lang.Integer> gatewayId()
- Returns:
- The unique identifier for the resource.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- 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.
-
network
public com.pulumi.core.Output<java.lang.String> network()
- Returns:
- The network this VPN gateway is accepting traffic for. ***
-
project
public com.pulumi.core.Output<java.lang.String> project()
- Returns:
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
-
region
public com.pulumi.core.Output<java.lang.String> region()
- Returns:
- The region this gateway should sit in.
-
selfLink
public com.pulumi.core.Output<java.lang.String> selfLink()
- Returns:
- The URI of the created resource.
-
get
public static VPNGateway get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable VPNGatewayState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name
- The _unique_ name of the resulting resource.id
- The _unique_ provider ID of the resource to lookup.state
-options
- Optional settings to control the behavior of the CustomResource.
-
-