googleComputeExternalVpnGateway
Represents a VPN gateway managed outside of GCP.
To get more information about ExternalVpnGateway, see:
Example Usage - External Vpn Gateway
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleComputeExternalVpnGatewayExternalGateway =
new google.computeExternalVpnGateway.ComputeExternalVpnGateway(
this,
"external_gateway",
{
description: "An externally managed VPN gateway",
interface: [
{
id: 0,
ip_address: "8.8.8.8",
},
],
name: "external-gateway",
redundancy_type: "SINGLE_IP_INTERNALLY_REDUNDANT",
}
);
const googleComputeNetworkNetwork = new google.computeNetwork.ComputeNetwork(
this,
"network",
{
auto_create_subnetworks: false,
name: "network-1",
routing_mode: "GLOBAL",
}
);
const googleComputeRouterRouter1 = new google.computeRouter.ComputeRouter(
this,
"router1",
{
bgp: [
{
asn: 64514,
},
],
name: "ha-vpn-router1",
network: googleComputeNetworkNetwork.name,
}
);
new google.computeSubnetwork.ComputeSubnetwork(this, "network_subnet1", {
ip_cidr_range: "10.0.1.0/24",
name: "ha-vpn-subnet-1",
network: googleComputeNetworkNetwork.id,
region: "us-central1",
});
new google.computeSubnetwork.ComputeSubnetwork(this, "network_subnet2", {
ip_cidr_range: "10.0.2.0/24",
name: "ha-vpn-subnet-2",
network: googleComputeNetworkNetwork.id,
region: "us-west1",
});
const googleComputeHaVpnGatewayHaGateway =
new google.computeHaVpnGateway.ComputeHaVpnGateway(this, "ha_gateway", {
name: "ha-vpn",
network: googleComputeNetworkNetwork.id,
region: "us-central1",
});
const googleComputeVpnTunnelTunnel1 =
new google.computeVpnTunnel.ComputeVpnTunnel(this, "tunnel1", {
name: "ha-vpn-tunnel1",
peer_external_gateway: googleComputeExternalVpnGatewayExternalGateway.id,
peer_external_gateway_interface: 0,
region: "us-central1",
router: googleComputeRouterRouter1.id,
shared_secret: "a secret message",
vpn_gateway: googleComputeHaVpnGatewayHaGateway.id,
vpn_gateway_interface: 0,
});
const googleComputeVpnTunnelTunnel2 =
new google.computeVpnTunnel.ComputeVpnTunnel(this, "tunnel2", {
name: "ha-vpn-tunnel2",
peer_external_gateway: googleComputeExternalVpnGatewayExternalGateway.id,
peer_external_gateway_interface: 0,
region: "us-central1",
router: ` \${${googleComputeRouterRouter1.id}}`,
shared_secret: "a secret message",
vpn_gateway: googleComputeHaVpnGatewayHaGateway.id,
vpn_gateway_interface: 1,
});
const googleComputeRouterInterfaceRouter1Interface1 =
new google.computeRouterInterface.ComputeRouterInterface(
this,
"router1_interface1",
{
ip_range: "169.254.0.1/30",
name: "router1-interface1",
region: "us-central1",
router: googleComputeRouterRouter1.name,
vpn_tunnel: googleComputeVpnTunnelTunnel1.name,
}
);
const googleComputeRouterInterfaceRouter1Interface2 =
new google.computeRouterInterface.ComputeRouterInterface(
this,
"router1_interface2",
{
ip_range: "169.254.1.1/30",
name: "router1-interface2",
region: "us-central1",
router: googleComputeRouterRouter1.name,
vpn_tunnel: googleComputeVpnTunnelTunnel2.name,
}
);
new google.computeRouterPeer.ComputeRouterPeer(this, "router1_peer1", {
advertised_route_priority: 100,
interface: googleComputeRouterInterfaceRouter1Interface1.name,
name: "router1-peer1",
peer_asn: 64515,
peer_ip_address: "169.254.0.2",
region: "us-central1",
router: googleComputeRouterRouter1.name,
});
new google.computeRouterPeer.ComputeRouterPeer(this, "router1_peer2", {
advertised_route_priority: 100,
interface: googleComputeRouterInterfaceRouter1Interface2.name,
name: "router1-peer2",
peer_asn: 64515,
peer_ip_address: "169.254.1.2",
region: "us-central1",
router: googleComputeRouterRouter1.name,
});
Argument Reference
The following arguments are supported:
name
- (Required) 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[aZ]([AZ09]*[aZ09])?
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.
-
description
- (Optional) An optional description of this resource. -
labels
- (Optional) Labels for the external VPN gateway resource. -
redundancyType
- (Optional) Indicates the redundancy type of this external VPN gateway Possible values arefourIpsRedundancy
,singleIpInternallyRedundant
, andtwoIpsRedundancy
. -
interface
- (Optional) A list of interfaces on this external VPN gateway. Structure is documented below. -
project
- (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
-
id
- (Optional) The numeric ID for this interface. Allowed values are based on the redundancy type of this external VPN gateway0SingleIpInternallyRedundant
0,1TwoIpsRedundancy
0,1,2,3FourIpsRedundancy
-
ipAddress
- (Optional) IP address of the interface in the external VPN gateway. Only IPv4 is supported. This IP address can be either from your on-premise gateway or another Cloud provider's VPN gateway, it cannot be an IP address from Google Compute Engine.
Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with formatprojects/{{project}}/global/externalVpnGateways/{{name}}
selfLink
- The URI of the created resource.
Timeouts
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.delete
- Default is 20 minutes.
Import
ExternalVpnGateway can be imported using any of these accepted formats:
$ terraform import google_compute_external_vpn_gateway.default projects/{{project}}/global/externalVpnGateways/{{name}}
$ terraform import google_compute_external_vpn_gateway.default {{project}}/{{name}}
$ terraform import google_compute_external_vpn_gateway.default {{name}}
User Project Overrides
This resource supports User Project Overrides.