providers/aws: its okay to delete something that is already gone
This commit is contained in:
parent
b0a83adea4
commit
e33739209b
|
@ -56,6 +56,11 @@ func resource_aws_internet_gateway_destroy(
|
||||||
|
|
||||||
log.Printf("[INFO] Deleting Internet Gateway: %s", s.ID)
|
log.Printf("[INFO] Deleting Internet Gateway: %s", s.ID)
|
||||||
if _, err := ec2conn.DeleteInternetGateway(s.ID); err != nil {
|
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)
|
return fmt.Errorf("Error deleting internet gateway: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,11 @@ func resource_aws_subnet_destroy(
|
||||||
|
|
||||||
log.Printf("[INFO] Deleting Subnet: %s", s.ID)
|
log.Printf("[INFO] Deleting Subnet: %s", s.ID)
|
||||||
if _, err := ec2conn.DeleteSubnet(s.ID); err != nil {
|
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)
|
return fmt.Errorf("Error deleting subnet: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,11 @@ func resource_aws_vpc_destroy(
|
||||||
|
|
||||||
log.Printf("[INFO] Deleting VPC: %s", s.ID)
|
log.Printf("[INFO] Deleting VPC: %s", s.ID)
|
||||||
if _, err := ec2conn.DeleteVpc(s.ID); err != nil {
|
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)
|
return fmt.Errorf("Error deleting ELB: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue