provider/aws: Retry Redshift cluster deletion on InvalidClusterState (#15068)
This commit is contained in:
parent
e10de998eb
commit
4baaada826
|
@ -777,7 +777,16 @@ func resourceAwsRedshiftClusterDelete(d *schema.ResourceData, meta interface{})
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("[DEBUG] Redshift Cluster delete options: %s", deleteOpts)
|
log.Printf("[DEBUG] Redshift Cluster delete options: %s", deleteOpts)
|
||||||
|
err := resource.Retry(15*time.Minute, func() *resource.RetryError {
|
||||||
_, err := conn.DeleteCluster(&deleteOpts)
|
_, err := conn.DeleteCluster(&deleteOpts)
|
||||||
|
awsErr, ok := err.(awserr.Error)
|
||||||
|
if ok && awsErr.Code() == "InvalidClusterState" {
|
||||||
|
return resource.RetryableError(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return resource.NonRetryableError(err)
|
||||||
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("[ERROR] Error deleting Redshift Cluster (%s): %s", d.Id(), err)
|
return fmt.Errorf("[ERROR] Error deleting Redshift Cluster (%s): %s", d.Id(), err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue