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,8 +196,10 @@ func resourceAwsNetworkInterfaceDetach(oa *schema.Set, meta interface{}, eniId s
conn := meta.(*AWSClient).ec2conn
_, detach_err := conn.DetachNetworkInterface(detach_request)
if detach_err != nil {
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)
stateConf := &resource.StateChangeConf{