provider/aws: Retry Redshift cluster deletion on InvalidClusterState (#15068)

This commit is contained in:
Radek Simko 2017-06-05 09:48:33 +01:00 committed by GitHub
parent e10de998eb
commit 4baaada826
1 changed files with 10 additions and 1 deletions

View File

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