From 055482a9f5e3be0d0d115d59a08df55818155efa Mon Sep 17 00:00:00 2001 From: clint shryock Date: Tue, 5 Jan 2016 16:16:32 -0600 Subject: [PATCH] providers/aws: Update VPN Gateway test --- .../aws/resource_aws_vpn_gateway_test.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/builtin/providers/aws/resource_aws_vpn_gateway_test.go b/builtin/providers/aws/resource_aws_vpn_gateway_test.go index d6b01f313..3a4bb1747 100644 --- a/builtin/providers/aws/resource_aws_vpn_gateway_test.go +++ b/builtin/providers/aws/resource_aws_vpn_gateway_test.go @@ -128,10 +128,21 @@ func testAccCheckVpnGatewayDestroy(s *terraform.State) error { VpnGatewayIds: []*string{aws.String(rs.Primary.ID)}, }) if err == nil { - if len(resp.VpnGateways) > 0 { - return fmt.Errorf("still exists") + var v *ec2.VpnGateway + for _, g := range resp.VpnGateways { + if *g.VpnGatewayId == rs.Primary.ID { + v = g + } } + if v == nil { + // wasn't found + return nil + } + + if *v.State != "deleted" { + return fmt.Errorf("Expected VpnGateway to be in deleted state, but was not: %s", v) + } return nil }