|
|
|
|
@ -117,45 +117,87 @@ func testAccAwsVpnConnection(
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestAccAWSVpnConnection_xmlconfig(t *testing.T) {
|
|
|
|
|
tunnelInfo := xmlConfigToTunnelInfo(testAccAwsVpnTunnelInfoXML)
|
|
|
|
|
if tunnelInfo.Tunnel1Address != "FIRST_ADDRESS" {
|
|
|
|
|
t.Fatalf("First address from tunnel XML was incorrect.")
|
|
|
|
|
}
|
|
|
|
|
if tunnelInfo.Tunnel1PreSharedKey != "FIRST_KEY" {
|
|
|
|
|
t.Fatalf("First key from tunnel XML was incorrect.")
|
|
|
|
|
}
|
|
|
|
|
if tunnelInfo.Tunnel2Address != "SECOND_ADDRESS" {
|
|
|
|
|
t.Fatalf("Second address from tunnel XML was incorrect.")
|
|
|
|
|
}
|
|
|
|
|
if tunnelInfo.Tunnel2PreSharedKey != "SECOND_KEY" {
|
|
|
|
|
t.Fatalf("Second key from tunnel XML was incorrect.")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const testAccAwsVpnConnectionConfig = `
|
|
|
|
|
resource "aws_vpn_gateway" "vpn_gateway" {
|
|
|
|
|
tags {
|
|
|
|
|
Name = "vpn_gateway"
|
|
|
|
|
}
|
|
|
|
|
tags {
|
|
|
|
|
Name = "vpn_gateway"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resource "aws_customer_gateway" "customer_gateway" {
|
|
|
|
|
bgp_asn = 60000
|
|
|
|
|
ip_address = "178.0.0.1"
|
|
|
|
|
type = "ipsec.1"
|
|
|
|
|
bgp_asn = 60000
|
|
|
|
|
ip_address = "178.0.0.1"
|
|
|
|
|
type = "ipsec.1"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resource "aws_vpn_connection" "foo" {
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
// Change static_routes_only to be false, forcing a refresh.
|
|
|
|
|
const testAccAwsVpnConnectionConfigUpdate = `
|
|
|
|
|
resource "aws_vpn_gateway" "vpn_gateway" {
|
|
|
|
|
tags {
|
|
|
|
|
Name = "vpn_gateway"
|
|
|
|
|
}
|
|
|
|
|
tags {
|
|
|
|
|
Name = "vpn_gateway"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resource "aws_customer_gateway" "customer_gateway" {
|
|
|
|
|
bgp_asn = 60000
|
|
|
|
|
ip_address = "178.0.0.1"
|
|
|
|
|
type = "ipsec.1"
|
|
|
|
|
bgp_asn = 60000
|
|
|
|
|
ip_address = "178.0.0.1"
|
|
|
|
|
type = "ipsec.1"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resource "aws_vpn_connection" "foo" {
|
|
|
|
|
vpn_gateway_id = "${aws_vpn_gateway.vpn_gateway.id}"
|
|
|
|
|
customer_gateway_id = "${aws_customer_gateway.customer_gateway.id}"
|
|
|
|
|
type = "ipsec.1"
|
|
|
|
|
static_routes_only = false
|
|
|
|
|
vpn_gateway_id = "${aws_vpn_gateway.vpn_gateway.id}"
|
|
|
|
|
customer_gateway_id = "${aws_customer_gateway.customer_gateway.id}"
|
|
|
|
|
type = "ipsec.1"
|
|
|
|
|
static_routes_only = false
|
|
|
|
|
}
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
// Test our VPN tunnel config XML parsing
|
|
|
|
|
const testAccAwsVpnTunnelInfoXML = `
|
|
|
|
|
<vpn_connection id="vpn-abc123">
|
|
|
|
|
<ipsec_tunnel>
|
|
|
|
|
<vpn_gateway>
|
|
|
|
|
<tunnel_outside_address>
|
|
|
|
|
<ip_address>SECOND_ADDRESS</ip_address>
|
|
|
|
|
</tunnel_outside_address>
|
|
|
|
|
</vpn_gateway>
|
|
|
|
|
<ike>
|
|
|
|
|
<pre_shared_key>SECOND_KEY</pre_shared_key>
|
|
|
|
|
</ike>
|
|
|
|
|
</ipsec_tunnel>
|
|
|
|
|
<ipsec_tunnel>
|
|
|
|
|
<vpn_gateway>
|
|
|
|
|
<tunnel_outside_address>
|
|
|
|
|
<ip_address>FIRST_ADDRESS</ip_address>
|
|
|
|
|
</tunnel_outside_address>
|
|
|
|
|
</vpn_gateway>
|
|
|
|
|
<ike>
|
|
|
|
|
<pre_shared_key>FIRST_KEY</pre_shared_key>
|
|
|
|
|
</ike>
|
|
|
|
|
</ipsec_tunnel>
|
|
|
|
|
</vpn_connection>
|
|
|
|
|
`
|
|
|
|
|
|