From 44e93526a1d12140e0c5078f7fb5895351bf6ae0 Mon Sep 17 00:00:00 2001 From: Vincent Latombe Date: Fri, 23 Oct 2015 15:03:54 +0200 Subject: [PATCH] provider/aws: ignore association not exist on route table destroy [GH-3615] --- builtin/providers/aws/resource_aws_route_table.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builtin/providers/aws/resource_aws_route_table.go b/builtin/providers/aws/resource_aws_route_table.go index 5f5660f19e..d5b76f7153 100644 --- a/builtin/providers/aws/resource_aws_route_table.go +++ b/builtin/providers/aws/resource_aws_route_table.go @@ -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 }