Skip to content

googleComputeHaVpnGateway

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:

Example Usage - Ha Vpn Gateway Basic

/*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 googleComputeNetworkNetwork1 = new google.computeNetwork.ComputeNetwork(
  this,
  "network1",
  {
    auto_create_subnetworks: false,
    name: "network1",
  }
);
new google.computeHaVpnGateway.ComputeHaVpnGateway(this, "ha_gateway1", {
  name: "ha-vpn-1",
  network: googleComputeNetworkNetwork1.id,
  region: "us-central1",
});

Example Usage - Compute Ha Vpn Gateway Encrypted Interconnect

/*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 googleComputeNetworkNetwork = new google.computeNetwork.ComputeNetwork(
  this,
  "network",
  {
    auto_create_subnetworks: false,
    name: "test-network",
  }
);
const googleComputeRouterRouter = new google.computeRouter.ComputeRouter(
  this,
  "router",
  {
    bgp: [
      {
        asn: 16550,
      },
    ],
    encrypted_interconnect_router: true,
    name: "test-router",
    network: googleComputeNetworkNetwork.name,
  }
);
const googleComputeAddressAddress1 = new google.computeAddress.ComputeAddress(
  this,
  "address1",
  {
    address: "192.168.1.0",
    address_type: "INTERNAL",
    name: "test-address1",
    network: googleComputeNetworkNetwork.selfLink,
    prefix_length: 29,
    purpose: "IPSEC_INTERCONNECT",
  }
);
const googleComputeAddressAddress2 = new google.computeAddress.ComputeAddress(
  this,
  "address2",
  {
    address: "192.168.2.0",
    address_type: "INTERNAL",
    name: "test-address2",
    network: googleComputeNetworkNetwork.selfLink,
    prefix_length: 29,
    purpose: "IPSEC_INTERCONNECT",
  }
);
const googleComputeInterconnectAttachmentAttachment1 =
  new google.computeInterconnectAttachment.ComputeInterconnectAttachment(
    this,
    "attachment1",
    {
      edge_availability_domain: "AVAILABILITY_DOMAIN_1",
      encryption: "IPSEC",
      ipsec_internal_addresses: [googleComputeAddressAddress1.selfLink],
      name: "test-interconnect-attachment1",
      router: googleComputeRouterRouter.id,
      type: "PARTNER",
    }
  );
const googleComputeInterconnectAttachmentAttachment2 =
  new google.computeInterconnectAttachment.ComputeInterconnectAttachment(
    this,
    "attachment2",
    {
      edge_availability_domain: "AVAILABILITY_DOMAIN_2",
      encryption: "IPSEC",
      ipsec_internal_addresses: [googleComputeAddressAddress2.selfLink],
      name: "test-interconnect-attachment2",
      router: googleComputeRouterRouter.id,
      type: "PARTNER",
    }
  );
new google.computeHaVpnGateway.ComputeHaVpnGateway(this, "vpn-gateway", {
  name: "test-ha-vpngw",
  network: googleComputeNetworkNetwork.id,
  vpn_interfaces: [
    {
      id: 0,
      interconnect_attachment:
        googleComputeInterconnectAttachmentAttachment1.selfLink,
    },
    {
      id: 1,
      interconnect_attachment:
        googleComputeInterconnectAttachmentAttachment2.selfLink,
    },
  ],
});

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.

  • network - (Required) The network this VPN gateway is accepting traffic for.


  • description - (Optional) An optional description of this resource.

  • vpnInterfaces - (Optional) A list of interfaces on this VPN gateway. Structure is documented below.

  • region - (Optional) The region this gateway should sit in.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

The vpnInterfaces block supports:

  • id - (Optional) The numeric ID of this VPN gateway interface.

  • ipAddress - (Output) The external IP address for this VPN gateway interface.

  • interconnectAttachment - (Optional) URL of the interconnect attachment resource. When the value of this field is present, the VPN Gateway will be used for IPsec-encrypted Cloud Interconnect; all Egress or Ingress traffic for this VPN Gateway interface will go through the specified interconnect attachment resource. Not currently available publicly.

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format projects/{{project}}/regions/{{region}}/vpnGateways/{{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

HaVpnGateway can be imported using any of these accepted formats:

$ terraform import google_compute_ha_vpn_gateway.default projects/{{project}}/regions/{{region}}/vpnGateways/{{name}}
$ terraform import google_compute_ha_vpn_gateway.default {{project}}/{{region}}/{{name}}
$ terraform import google_compute_ha_vpn_gateway.default {{region}}/{{name}}
$ terraform import google_compute_ha_vpn_gateway.default {{name}}

User Project Overrides

This resource supports User Project Overrides.