aws_vpn_connection

Provides a VPN connection connected to a VPC. These objects can be connected to customer gateways, and allow you to establish tunnels between your network and the VPC.

Example Usage

resource "aws_vpc" "vpc" {
  cidr_block = "10.0.0.0/16"
}

resource "aws_vpn_gateway" "vpn_gateway" {
  vpc_id = "${aws_vpc.vpc.id}"
}

resource "aws_customer_gateway" "customer_gateway" {
  bgp_asn    = 65000
  ip_address = "172.0.0.1"
  type       = "ipsec.1"
}

resource "aws_vpn_connection" "main" {
  vpn_gateway_id      = "${aws_vpn_gateway.vpn_gateway.id}"
  customer_gateway_id = "${aws_customer_gateway.customer_gateway.id}"
  type                = "ipsec.1"
  static_routes_only  = true
}

Argument Reference

The following arguments are supported:

  • customer_gateway_id - (Required) The ID of the customer gateway.
  • static_routes_only - (Optional, Default false) Whether the VPN connection uses static routes exclusively. Static routes must be used for devices that don't support BGP.
  • tags - (Optional) Tags to apply to the connection.
  • type - (Required) The type of VPN connection. The only type AWS supports at this time is "ipsec.1".
  • vpn_gateway_id - (Required) The ID of the virtual private gateway.
  • tunnel1_inside_cidr - (Optional) The CIDR block of the inside IP addresses for the first VPN tunnel.
  • tunnel2_inside_cidr - (Optional) The CIDR block of the second IP addresses for the first VPN tunnel.
  • tunnel1_preshared_key - (Optional) The preshared key of the first VPN tunnel.
  • tunnel2_preshared_key - (Optional) The preshared key of the second VPN tunnel. ~> Note: The preshared key must be between 8 and 64 characters in length and cannot start with zero(0). Allowed characters are alphanumeric characters, periods(.) and underscores(_).

Attribute Reference

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

Import

VPN Connections can be imported using the vpn connection id, e.g.

$ terraform import aws_vpn_connection.testvpnconnection vpn-40f41529

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/aws/r/vpn_connection.html