providers/aws: its okay to delete something that is already gone

This commit is contained in:
Mitchell Hashimoto 2014-07-07 17:07:31 -07:00
parent b0a83adea4
commit e33739209b
3 changed files with 15 additions and 0 deletions

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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)
}