Merge pull request #4518 from hashicorp/b-aws-resources-tests

providers/aws: Update VPN Gateway test
This commit is contained in:
Clint 2016-01-05 16:43:14 -06:00
commit 5b3ef43b1c
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
}