Ignore missing ENI attachment when trying to detach (#7185)

This commit is contained in:
Jonathan McCall 2016-07-25 13:48:33 -04:00 committed by Paul Stack
parent f5e882eca6
commit 3c702f2d75
1 changed files with 3 additions and 1 deletions

View File

@ -196,7 +196,9 @@ func resourceAwsNetworkInterfaceDetach(oa *schema.Set, meta interface{}, eniId s
conn := meta.(*AWSClient).ec2conn
_, detach_err := conn.DetachNetworkInterface(detach_request)
if detach_err != nil {
return fmt.Errorf("Error detaching ENI: %s", detach_err)
if awsErr, _ := detach_err.(awserr.Error); awsErr.Code() != "InvalidAttachmentID.NotFound" {
return fmt.Errorf("Error detaching ENI: %s", detach_err)
}
}
log.Printf("[DEBUG] Waiting for ENI (%s) to become dettached", eniId)