From fdb1b065947129f2a37c4a7d387d3362e60892e7 Mon Sep 17 00:00:00 2001 From: George Blue Date: Wed, 5 Apr 2023 14:32:33 +0100 Subject: [PATCH] fix: error when scaling elasticache_replication_group When adding extra nodes to an elasticache_replication_group, we saw the error: ``` Error: modifying ElastiCache Replication Group (csbb2a2560a-acf7-4106-9618-4263082cb536) clusters: error waiting for ElastiCache Replication Group (csbb2a2560a-acf7-4106-9618-4263082cb536) replica addition: unexpected state 'snapshotting', wanted target 'available'. last error: %!s() with aws_elasticache_replication_group.redis, on main.tf line 46, in resource "aws_elasticache_replication_group" "redis": 46: resource "aws_elasticache_replication_group" "redis" ``` Looks like a snapshot occurred while waiting for the scale up. I see that "snapshotting" is an allowed state in the `WaitReplicationGroupAvailable()` function, so for consistency it makes sense for it to also be allowed in the `WaitReplicationGroupMemberClustersAvailable()` function. Testing: tests of this functionality don't seem to go into this level of detail, so no tests were modified. --- internal/service/elasticache/wait.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/service/elasticache/wait.go b/internal/service/elasticache/wait.go index a63d8862de2..5370663b4e0 100644 --- a/internal/service/elasticache/wait.go +++ b/internal/service/elasticache/wait.go @@ -71,6 +71,7 @@ func WaitReplicationGroupMemberClustersAvailable(ctx context.Context, conn *elas CacheClusterStatusCreating, CacheClusterStatusDeleting, CacheClusterStatusModifying, + CacheClusterStatusSnapshotting, }, Target: []string{CacheClusterStatusAvailable}, Refresh: StatusReplicationGroupMemberClusters(ctx, conn, replicationGroupID),