diff --git a/builtin/providers/aws/resource_aws_elasticache_cluster.go b/builtin/providers/aws/resource_aws_elasticache_cluster.go index b62df2dec2..ee7848387d 100644 --- a/builtin/providers/aws/resource_aws_elasticache_cluster.go +++ b/builtin/providers/aws/resource_aws_elasticache_cluster.go @@ -308,7 +308,8 @@ func resourceAwsElasticacheClusterDelete(d *schema.ResourceData, meta interface{ func CacheClusterStateRefreshFunc(conn *elasticache.ElastiCache, clusterID, givenState string, pending []string) resource.StateRefreshFunc { return func() (interface{}, string, error) { resp, err := conn.DescribeCacheClusters(&elasticache.DescribeCacheClustersInput{ - CacheClusterID: aws.String(clusterID), + CacheClusterID: aws.String(clusterID), + ShowCacheNodeInfo: aws.Boolean(true), }) if err != nil { apierr := err.(awserr.Error) @@ -336,6 +337,13 @@ func CacheClusterStateRefreshFunc(conn *elasticache.ElastiCache, clusterID, give // return given state if it's not in pending if givenState != "" { + // loop the nodes and check their status as well + for _, n := range c.CacheNodes { + if n.CacheNodeStatus != nil && *n.CacheNodeStatus != "available" { + log.Printf("[DEBUG] Node (%s) is not yet available, status: %s", *n.CacheNodeID, *n.CacheNodeStatus) + return nil, "creating", nil + } + } return c, givenState, nil } log.Printf("[DEBUG] current status: %v", *c.CacheClusterStatus)