A VPN connection
To get more information about VpnConnection, see:
resource "google_edgecontainer_cluster" "cluster" {
name = "default"
location = "us-central1"
authorization {
admin_users {
username = "admin@hashicorptest.com"
}
}
networking {
cluster_ipv4_cidr_blocks = ["10.0.0.0/16"]
services_ipv4_cidr_blocks = ["10.1.0.0/16"]
}
fleet {
project = "projects/${data.google_project.project.number}"
}
}
resource "google_edgecontainer_node_pool" "node_pool" {
name = "nodepool-1"
cluster = google_edgecontainer_cluster.cluster.name
location = "us-central1"
node_location = "us-central1-edge-example-edgesite"
node_count = 3
}
resource "google_edgecontainer_vpn_connection" "default" {
depends_on = [google_edgecontainer_node_pool.node_pool]
name = "vpn-connection-1"
location = "us-central1"
cluster = "projects/${data.google_project.project.number}/locations/us-east1/clusters/${google_edgecontainer_cluster.cluster.name}"
vpc = google_compute_network.vpc.name
enable_high_availability = true
labels = {
my_key = "my_val"
other_key = "other_val"
}
}
resource "google_compute_network" "vpc" {
name = "example-vpc"
}
data "google_project" "project" {}
The following arguments are supported:
cluster
-
(Required)
The canonical Cluster name to connect to. It is in the form of projects/{project}/locations/{location}/clusters/{cluster}.
name
-
(Required)
The resource name of VPN connection
location
-
(Required)
Google Cloud Platform location.
labels
-
(Optional)
Labels associated with this resource.
Note: This field is non-authoritative, and will only manage the labels present in your configuration.
Please refer to the field effective_labels
for all of the labels present on the resource.
nat_gateway_ip
-
(Optional)
NAT gateway IP, or WAN IP address. If a customer has multiple NAT IPs, the customer needs to configure NAT such that only one external IP maps to the GMEC Anthos cluster.
This is empty if NAT is not used.
vpc
-
(Optional)
The network ID of VPC to connect to.
vpc_project
-
(Optional)
Project detail of the VPC network. Required if VPC is in a different project than the cluster project.
Structure is documented below.
enable_high_availability
-
(Optional)
Whether this VPN connection has HA enabled on cluster side. If enabled, when creating VPN connection we will attempt to use 2 ANG floating IPs.
router
-
(Optional)
The VPN connection Cloud Router name.
project
- (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
The vpc_project
block supports:
project_id
-
(Optional)
The project of the VPC to connect to. If not specified, it is the same as the cluster project.In addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with format projects/{{project}}/locations/{{location}}/vpnConnections/{{name}}
create_time
-
The time when the VPN connection was created.
update_time
-
The time when the VPN connection was last updated.
details
-
A nested object resource
Structure is documented below.
terraform_labels
-
The combination of labels configured directly on the resource
and default labels configured on the provider.
effective_labels
-
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.
state
-
(Output)
The current connection state.
error
-
(Output)
The error message. This is only populated when state=ERROR.
cloud_router
-
(Output)
The Cloud Router info.
Structure is documented below.
cloud_vpns
-
(Output)
Each connection has multiple Cloud VPN gateways.
Structure is documented below.
The cloud_router
block contains:
name
-
(Output)
The associated Cloud Router name.The cloud_vpns
block contains:
gateway
-
(Output)
The created Cloud VPN gateway name.This resource provides the following Timeouts configuration options:
create
- Default is 30 minutes.update
- Default is 30 minutes.delete
- Default is 30 minutes.VpnConnection can be imported using any of these accepted formats:
projects/{{project}}/locations/{{location}}/vpnConnections/{{name}}
{{project}}/{{location}}/{{name}}
{{location}}/{{name}}
In Terraform v1.5.0 and later, use an import
block to import VpnConnection using one of the formats above. For example:
import {
id = "projects/{{project}}/locations/{{location}}/vpnConnections/{{name}}"
to = google_edgecontainer_vpn_connection.default
}
When using the terraform import
command, VpnConnection can be imported using one of the formats above. For example:
$ terraform import google_edgecontainer_vpn_connection.default projects/{{project}}/locations/{{location}}/vpnConnections/{{name}}
$ terraform import google_edgecontainer_vpn_connection.default {{project}}/{{location}}/{{name}}
$ terraform import google_edgecontainer_vpn_connection.default {{location}}/{{name}}
This resource supports User Project Overrides.