Skip to content

Commit 5b3ef43

Browse files
committed
Merge pull request hashicorp#4518 from hashicorp/b-aws-resources-tests
providers/aws: Update VPN Gateway test
2 parents 6364cfe + 055482a commit 5b3ef43

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

builtin/providers/aws/resource_aws_vpn_gateway_test.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,21 @@ func testAccCheckVpnGatewayDestroy(s *terraform.State) error {
128128
VpnGatewayIds: []*string{aws.String(rs.Primary.ID)},
129129
})
130130
if err == nil {
131-
if len(resp.VpnGateways) > 0 {
132-
return fmt.Errorf("still exists")
131+
var v *ec2.VpnGateway
132+
for _, g := range resp.VpnGateways {
133+
if *g.VpnGatewayId == rs.Primary.ID {
134+
v = g
135+
}
133136
}
134137

138+
if v == nil {
139+
// wasn't found
140+
return nil
141+
}
142+
143+
if *v.State != "deleted" {
144+
return fmt.Errorf("Expected VpnGateway to be in deleted state, but was not: %s", v)
145+
}
135146
return nil
136147
}
137148

0 commit comments

Comments
 (0)