Acc tests for aws_vpn_connection tunnel attributes.

This commit is contained in:
Cameron Stokes 2016-02-06 14:00:26 -08:00
parent a239a2a125
commit 24f034a2c6
1 changed files with 63 additions and 21 deletions

View File

@ -117,6 +117,22 @@ 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 {
@ -159,3 +175,29 @@ resource "aws_vpn_connection" "foo" {
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>
`