provider/aws: fix CheckDestroy on glacier vault
This commit is contained in:
parent
7d6b98060a
commit
02f14ae34a
|
@ -182,11 +182,26 @@ func testAccCheckVaultNotificationsMissing(name string) resource.TestCheckFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccCheckGlacierVaultDestroy(s *terraform.State) error {
|
func testAccCheckGlacierVaultDestroy(s *terraform.State) error {
|
||||||
if len(s.RootModule().Resources) > 0 {
|
conn := testAccProvider.Meta().(*AWSClient).glacierconn
|
||||||
return fmt.Errorf("Expected all resources to be gone, but found: %#v",
|
|
||||||
s.RootModule().Resources)
|
for _, rs := range s.RootModule().Resources {
|
||||||
|
if rs.Type != "aws_glacier_vault" {
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input := &glacier.DescribeVaultInput{
|
||||||
|
VaultName: aws.String(rs.Primary.ID),
|
||||||
|
}
|
||||||
|
if _, err := conn.DescribeVault(input); err != nil {
|
||||||
|
// Verify the error is what we want
|
||||||
|
if ae, ok := err.(awserr.Error); ok && ae.Code() == "ResourceNotFoundException" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return fmt.Errorf("still exists")
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue