diff --git a/builtin/providers/aws/resource_aws_internet_gateway.go b/builtin/providers/aws/resource_aws_internet_gateway.go index c45f99d4f..d7542aab6 100644 --- a/builtin/providers/aws/resource_aws_internet_gateway.go +++ b/builtin/providers/aws/resource_aws_internet_gateway.go @@ -56,6 +56,11 @@ func resource_aws_internet_gateway_destroy( log.Printf("[INFO] Deleting Internet Gateway: %s", s.ID) if _, err := ec2conn.DeleteInternetGateway(s.ID); err != nil { + ec2err, ok := err.(*ec2.Error) + if ok && ec2err.Code == "InvalidInternetGatewayID.NotFound" { + return nil + } + return fmt.Errorf("Error deleting internet gateway: %s", err) } diff --git a/builtin/providers/aws/resource_aws_subnet.go b/builtin/providers/aws/resource_aws_subnet.go index 44180d143..4e0ef5597 100644 --- a/builtin/providers/aws/resource_aws_subnet.go +++ b/builtin/providers/aws/resource_aws_subnet.go @@ -78,6 +78,11 @@ func resource_aws_subnet_destroy( log.Printf("[INFO] Deleting Subnet: %s", s.ID) if _, err := ec2conn.DeleteSubnet(s.ID); err != nil { + ec2err, ok := err.(*ec2.Error) + if ok && ec2err.Code == "InvalidSubnetID.NotFound" { + return nil + } + return fmt.Errorf("Error deleting subnet: %s", err) } diff --git a/builtin/providers/aws/resource_aws_vpc.go b/builtin/providers/aws/resource_aws_vpc.go index 3f8646015..218b3bc17 100644 --- a/builtin/providers/aws/resource_aws_vpc.go +++ b/builtin/providers/aws/resource_aws_vpc.go @@ -76,6 +76,11 @@ func resource_aws_vpc_destroy( log.Printf("[INFO] Deleting VPC: %s", s.ID) if _, err := ec2conn.DeleteVpc(s.ID); err != nil { + ec2err, ok := err.(*ec2.Error) + if ok && ec2err.Code == "InvalidVpcID.NotFound" { + return nil + } + return fmt.Errorf("Error deleting ELB: %s", err) }