Class HaVpnGateway
Represents a VPN gateway running in GCP. This virtual device is managed by Google, but used only by you. This type of VPN Gateway allows for the creation of VPN solutions with higher availability than classic Target VPN Gateways.
To get more information about HaVpnGateway, see:
- API documentation
- How-to Guides
- Choosing a VPN
- Cloud VPN Overview
Example Usage - Ha Vpn Gateway Basic
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var network1 = new Gcp.Compute.Network("network1", new Gcp.Compute.NetworkArgs
{
AutoCreateSubnetworks = false,
});
var haGateway1 = new Gcp.Compute.HaVpnGateway("haGateway1", new Gcp.Compute.HaVpnGatewayArgs
{
Region = "us-central1",
Network = network1.Id,
});
}
}
Example Usage - Ha Vpn Gateway Gcp To Gcp
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var network1 = new Gcp.Compute.Network("network1", new Gcp.Compute.NetworkArgs
{
RoutingMode = "GLOBAL",
AutoCreateSubnetworks = false,
});
var haGateway1 = new Gcp.Compute.HaVpnGateway("haGateway1", new Gcp.Compute.HaVpnGatewayArgs
{
Region = "us-central1",
Network = network1.Id,
});
var network2 = new Gcp.Compute.Network("network2", new Gcp.Compute.NetworkArgs
{
RoutingMode = "GLOBAL",
AutoCreateSubnetworks = false,
});
var haGateway2 = new Gcp.Compute.HaVpnGateway("haGateway2", new Gcp.Compute.HaVpnGatewayArgs
{
Region = "us-central1",
Network = network2.Id,
});
var network1Subnet1 = new Gcp.Compute.Subnetwork("network1Subnet1", new Gcp.Compute.SubnetworkArgs
{
IpCidrRange = "10.0.1.0/24",
Region = "us-central1",
Network = network1.Id,
});
var network1Subnet2 = new Gcp.Compute.Subnetwork("network1Subnet2", new Gcp.Compute.SubnetworkArgs
{
IpCidrRange = "10.0.2.0/24",
Region = "us-west1",
Network = network1.Id,
});
var network2Subnet1 = new Gcp.Compute.Subnetwork("network2Subnet1", new Gcp.Compute.SubnetworkArgs
{
IpCidrRange = "192.168.1.0/24",
Region = "us-central1",
Network = network2.Id,
});
var network2Subnet2 = new Gcp.Compute.Subnetwork("network2Subnet2", new Gcp.Compute.SubnetworkArgs
{
IpCidrRange = "192.168.2.0/24",
Region = "us-east1",
Network = network2.Id,
});
var router1 = new Gcp.Compute.Router("router1", new Gcp.Compute.RouterArgs
{
Network = network1.Name,
Bgp = new Gcp.Compute.Inputs.RouterBgpArgs
{
Asn = 64514,
},
});
var router2 = new Gcp.Compute.Router("router2", new Gcp.Compute.RouterArgs
{
Network = network2.Name,
Bgp = new Gcp.Compute.Inputs.RouterBgpArgs
{
Asn = 64515,
},
});
var tunnel1 = new Gcp.Compute.VPNTunnel("tunnel1", new Gcp.Compute.VPNTunnelArgs
{
Region = "us-central1",
VpnGateway = haGateway1.Id,
PeerGcpGateway = haGateway2.Id,
SharedSecret = "a secret message",
Router = router1.Id,
VpnGatewayInterface = 0,
});
var tunnel2 = new Gcp.Compute.VPNTunnel("tunnel2", new Gcp.Compute.VPNTunnelArgs
{
Region = "us-central1",
VpnGateway = haGateway1.Id,
PeerGcpGateway = haGateway2.Id,
SharedSecret = "a secret message",
Router = router1.Id,
VpnGatewayInterface = 1,
});
var tunnel3 = new Gcp.Compute.VPNTunnel("tunnel3", new Gcp.Compute.VPNTunnelArgs
{
Region = "us-central1",
VpnGateway = haGateway2.Id,
PeerGcpGateway = haGateway1.Id,
SharedSecret = "a secret message",
Router = router2.Id,
VpnGatewayInterface = 0,
});
var tunnel4 = new Gcp.Compute.VPNTunnel("tunnel4", new Gcp.Compute.VPNTunnelArgs
{
Region = "us-central1",
VpnGateway = haGateway2.Id,
PeerGcpGateway = haGateway1.Id,
SharedSecret = "a secret message",
Router = router2.Id,
VpnGatewayInterface = 1,
});
var router1Interface1 = new Gcp.Compute.RouterInterface("router1Interface1", new Gcp.Compute.RouterInterfaceArgs
{
Router = router1.Name,
Region = "us-central1",
IpRange = "169.254.0.1/30",
VpnTunnel = tunnel1.Name,
});
var router1Peer1 = new Gcp.Compute.RouterPeer("router1Peer1", new Gcp.Compute.RouterPeerArgs
{
Router = router1.Name,
Region = "us-central1",
PeerIpAddress = "169.254.0.2",
PeerAsn = 64515,
AdvertisedRoutePriority = 100,
Interface = router1Interface1.Name,
});
var router1Interface2 = new Gcp.Compute.RouterInterface("router1Interface2", new Gcp.Compute.RouterInterfaceArgs
{
Router = router1.Name,
Region = "us-central1",
IpRange = "169.254.1.1/30",
VpnTunnel = tunnel2.Name,
});
var router1Peer2 = new Gcp.Compute.RouterPeer("router1Peer2", new Gcp.Compute.RouterPeerArgs
{
Router = router1.Name,
Region = "us-central1",
PeerIpAddress = "169.254.1.2",
PeerAsn = 64515,
AdvertisedRoutePriority = 100,
Interface = router1Interface2.Name,
});
var router2Interface1 = new Gcp.Compute.RouterInterface("router2Interface1", new Gcp.Compute.RouterInterfaceArgs
{
Router = router2.Name,
Region = "us-central1",
IpRange = "169.254.0.1/30",
VpnTunnel = tunnel3.Name,
});
var router2Peer1 = new Gcp.Compute.RouterPeer("router2Peer1", new Gcp.Compute.RouterPeerArgs
{
Router = router2.Name,
Region = "us-central1",
PeerIpAddress = "169.254.0.2",
PeerAsn = 64514,
AdvertisedRoutePriority = 100,
Interface = router2Interface1.Name,
});
var router2Interface2 = new Gcp.Compute.RouterInterface("router2Interface2", new Gcp.Compute.RouterInterfaceArgs
{
Router = router2.Name,
Region = "us-central1",
IpRange = "169.254.1.1/30",
VpnTunnel = tunnel4.Name,
});
var router2Peer2 = new Gcp.Compute.RouterPeer("router2Peer2", new Gcp.Compute.RouterPeerArgs
{
Router = router2.Name,
Region = "us-central1",
PeerIpAddress = "169.254.1.2",
PeerAsn = 64514,
AdvertisedRoutePriority = 100,
Interface = router2Interface2.Name,
});
}
}
Inherited Members
Namespace: Pulumi.Gcp.Compute
Assembly: Pulumi.Gcp.dll
Syntax
public class HaVpnGateway : CustomResource
Constructors
View SourceHaVpnGateway(String, HaVpnGatewayArgs, CustomResourceOptions)
Create a HaVpnGateway resource with the given unique name, arguments, and options.
Declaration
public HaVpnGateway(string name, HaVpnGatewayArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| HaVpnGatewayArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceDescription
An optional description of this resource.
Declaration
public Output<string> Description { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Name
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.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Network
The network this VPN gateway is accepting traffic for.
Declaration
public Output<string> Network { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Project
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
Declaration
public Output<string> Project { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Region
The region this gateway should sit in.
Declaration
public Output<string> Region { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
SelfLink
The URI of the created resource.
Declaration
public Output<string> SelfLink { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
VpnInterfaces
A list of interfaces on this VPN gateway.
Declaration
public Output<ImmutableArray<HaVpnGatewayVpnInterface>> VpnInterfaces { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<HaVpnGatewayVpnInterface>> |
Methods
View SourceGet(String, Input<String>, HaVpnGatewayState, CustomResourceOptions)
Get an existing HaVpnGateway resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static HaVpnGateway Get(string name, Input<string> id, HaVpnGatewayState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| HaVpnGatewayState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| HaVpnGateway |