provider/powerdns: Correct dangling resource check
This fix prevents tests incorrectly reporting dangling resources. It is not sufficient to check just whether or not an error occurred when iterating over the listed resources - checking the bool returned is also required.
This commit is contained in:
parent
ff8cb7270e
commit
688dde9bb9
|
@ -213,10 +213,14 @@ func testAccCheckPDNSRecordDestroy(s *terraform.State) error {
|
|||
}
|
||||
|
||||
client := testAccProvider.Meta().(*Client)
|
||||
_, err := client.RecordExistsByID(rs.Primary.Attributes["zone"], rs.Primary.ID)
|
||||
if err == nil {
|
||||
exists, err := client.RecordExistsByID(rs.Primary.Attributes["zone"], rs.Primary.ID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error checking if record still exists: %#v", rs.Primary.ID)
|
||||
}
|
||||
if exists {
|
||||
return fmt.Errorf("Record still exists: %#v", rs.Primary.ID)
|
||||
}
|
||||
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue