provider/aws: ignore association not exist on route table destroy

[GH-3615]
This commit is contained in:
Vincent Latombe 2015-10-23 15:03:54 +02:00
parent c817e7c765
commit 44e93526a1

View File

@ -325,6 +325,14 @@ func resourceAwsRouteTableDelete(d *schema.ResourceData, meta interface{}) error
_, err := conn.DisassociateRouteTable(&ec2.DisassociateRouteTableInput{
AssociationId: a.RouteTableAssociationId,
})
if err != nil {
// First check if the association ID is not found. If this
// is the case, then it was already disassociated somehow,
// and that is okay.
if ec2err, ok := err.(awserr.Error); ok && ec2err.Code() == "InvalidAssociationID.NotFound" {
err = nil
}
}
if err != nil {
return err
}