Merge pull request #448 from pmoust/gateway-destroy-retry
providers/aws: retry destroying internet gateway for some time [GH-447]
This commit is contained in:
commit
4d2ecab674
|
@ -14,6 +14,9 @@ BUG FIXES:
|
||||||
the correct data and don't incorrectly recreate themselves. [GH-425]
|
the correct data and don't incorrectly recreate themselves. [GH-425]
|
||||||
* providers/aws: Fix case where ELB would incorrectly plan to modify
|
* providers/aws: Fix case where ELB would incorrectly plan to modify
|
||||||
listeners (with the same data) in some cases.
|
listeners (with the same data) in some cases.
|
||||||
|
* providers/aws: Retry destroying internet gateway for some amount of time
|
||||||
|
if there is a dependency violation since it is probably just eventual
|
||||||
|
consistency (public facing resources being destroyed). [GH-447]
|
||||||
* providers/aws: Retry deleting security groups for some amount of time
|
* providers/aws: Retry deleting security groups for some amount of time
|
||||||
if there is a dependency violation since it is probably just eventual
|
if there is a dependency violation since it is probably just eventual
|
||||||
consistency. [GH-436]
|
consistency. [GH-436]
|
||||||
|
|
|
@ -81,14 +81,26 @@ 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 {
|
return resource.Retry(5*time.Minute, func() error {
|
||||||
|
_, err := ec2conn.DeleteInternetGateway(s.ID)
|
||||||
|
if err != nil {
|
||||||
ec2err, ok := err.(*ec2.Error)
|
ec2err, ok := err.(*ec2.Error)
|
||||||
if ok && ec2err.Code == "InvalidInternetGatewayID.NotFound" {
|
if !ok {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ec2err.Code {
|
||||||
|
case "InvalidInternetGatewayID.NotFound":
|
||||||
return nil
|
return nil
|
||||||
|
case "DependencyViolation":
|
||||||
|
return err // retry
|
||||||
|
default:
|
||||||
|
return resource.RetryError{err}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Errorf("Error deleting internet gateway: %s", err)
|
return fmt.Errorf("Error deleting internet gateway: %s", err)
|
||||||
}
|
})
|
||||||
|
|
||||||
// Wait for the internet gateway to actually delete
|
// Wait for the internet gateway to actually delete
|
||||||
log.Printf("[DEBUG] Waiting for internet gateway (%s) to delete", s.ID)
|
log.Printf("[DEBUG] Waiting for internet gateway (%s) to delete", s.ID)
|
||||||
|
|
Loading…
Reference in New Issue