Remove resource if volume to detach is missing

This commit is contained in:
Jonathan McCall 2016-09-29 17:56:52 -04:00
parent a3ceb25dd7
commit f3deaab878
1 changed files with 1 additions and 1 deletions

View File

@ -162,7 +162,7 @@ func resourceAwsVolumeAttachmentDelete(d *schema.ResourceData, meta interface{})
return fmt.Errorf("Error reading EC2 volume %s: %s", vID, desc_err)
}
if *attr.Volumes[0].State == "available" {
if len(attr.Volumes) == 0 || *attr.Volumes[0].State == "available" {
d.SetId("")
return nil
}