provider/openstack: Add SOFT_DELETED to delete status (#13444)

This commit allows clean deletion of instances that have a
status of SOFT_DELETED.
This commit is contained in:
Joe Topjian 2017-04-07 06:13:08 -06:00 committed by Paul Stack
parent 7451166ae7
commit cfd4101055
2 changed files with 5 additions and 3 deletions

View File

@ -919,7 +919,7 @@ func resourceComputeInstanceV2Delete(d *schema.ResourceData, meta interface{}) e
stateConf := &resource.StateChangeConf{
Pending: []string{"ACTIVE", "SHUTOFF"},
Target: []string{"DELETED"},
Target: []string{"DELETED", "SOFT_DELETED"},
Refresh: ServerV2StateRefreshFunc(computeClient, d.Id()),
Timeout: d.Timeout(schema.TimeoutDelete),
Delay: 10 * time.Second,

View File

@ -678,9 +678,11 @@ func testAccCheckComputeV2InstanceDestroy(s *terraform.State) error {
continue
}
_, err := servers.Get(computeClient, rs.Primary.ID).Extract()
server, err := servers.Get(computeClient, rs.Primary.ID).Extract()
if err == nil {
return fmt.Errorf("Instance still exists")
if server.Status != "SOFT_DELETED" {
return fmt.Errorf("Instance still exists")
}
}
}