From aa894d98d93b48fbf3d12ed15cfc501191eb1be9 Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Tue, 13 Jun 2017 09:19:14 +0100 Subject: [PATCH] resource/rds_cluster: Retry modification on InvalidDBClusterStateFault --- aws/resource_aws_rds_cluster.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/aws/resource_aws_rds_cluster.go b/aws/resource_aws_rds_cluster.go index 8fc72ce5bb7..a78a28666b1 100644 --- a/aws/resource_aws_rds_cluster.go +++ b/aws/resource_aws_rds_cluster.go @@ -623,9 +623,19 @@ func resourceAwsRDSClusterUpdate(d *schema.ResourceData, meta interface{}) error } if requestUpdate { - _, err := conn.ModifyDBCluster(req) + err := resource.Retry(5*time.Minute, func() *resource.RetryError { + _, err := conn.ModifyDBCluster(req) + if err != nil { + awsErr, ok := err.(awserr.Error) + if ok && awsErr.Code() == rds.ErrCodeInvalidDBClusterStateFault { + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) if err != nil { - return fmt.Errorf("[WARN] Error modifying RDS Cluster (%s): %s", d.Id(), err) + return fmt.Errorf("Failed to modify RDS Cluster (%s): %s", d.Id(), err) } }