providers/aws: Update VPN Gateway test

This commit is contained in:
clint shryock 2016-01-05 16:16:32 -06:00
parent 449ffe027f
commit 055482a9f5
1 changed files with 13 additions and 2 deletions

View File

@ -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
}