From f19f9f8ed19328d3ff61983d49783ca361ad1ea7 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 17 Jul 2024 09:08:24 -0400 Subject: [PATCH] d/aws_elasticache_replication_group: Add `cluster_mode` attribute. --- .changelog/38002.txt | 4 ++++ .../service/elasticache/replication_group_data_source.go | 9 ++++++--- .../elasticache/replication_group_data_source_test.go | 1 + .../docs/d/elasticache_replication_group.html.markdown | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.changelog/38002.txt b/.changelog/38002.txt index 7a8ce7b7243..0c0ec580e79 100644 --- a/.changelog/38002.txt +++ b/.changelog/38002.txt @@ -1,3 +1,7 @@ ```release-note:enhancement resource/aws_elasticache_replication_group: Add `cluster_mode` argument +``` + +```release-note:enhancement +data-source/aws_elasticache_replication_group: Add `cluster_mode` attribute ``` \ No newline at end of file diff --git a/internal/service/elasticache/replication_group_data_source.go b/internal/service/elasticache/replication_group_data_source.go index f582054f0f2..895fd6b92e0 100644 --- a/internal/service/elasticache/replication_group_data_source.go +++ b/internal/service/elasticache/replication_group_data_source.go @@ -35,6 +35,10 @@ func dataSourceReplicationGroup() *schema.Resource { Type: schema.TypeBool, Computed: true, }, + "cluster_mode": { + Type: schema.TypeString, + Computed: true, + }, "configuration_endpoint_address": { Type: schema.TypeString, Computed: true, @@ -125,9 +129,7 @@ func dataSourceReplicationGroupRead(ctx context.Context, d *schema.ResourceData, var diags diag.Diagnostics conn := meta.(*conns.AWSClient).ElastiCacheClient(ctx) - groupID := d.Get("replication_group_id").(string) - - rg, err := findReplicationGroupByID(ctx, conn, groupID) + rg, err := findReplicationGroupByID(ctx, conn, d.Get("replication_group_id").(string)) if err != nil { return sdkdiag.AppendFromErr(diags, tfresource.SingularDataSourceFindError("ElastiCache Replication Group", err)) @@ -174,6 +176,7 @@ func dataSourceReplicationGroupRead(ctx context.Context, d *schema.ResourceData, d.Set("node_type", rg.CacheNodeType) d.Set("num_node_groups", len(rg.NodeGroups)) d.Set("replicas_per_node_group", len(rg.NodeGroups[0].NodeGroupMembers)-1) + d.Set("cluster_mode", rg.ClusterMode) d.Set("log_delivery_configuration", flattenLogDeliveryConfigurations(rg.LogDeliveryConfigurations)) d.Set("snapshot_window", rg.SnapshotWindow) d.Set("snapshot_retention_limit", rg.SnapshotRetentionLimit) diff --git a/internal/service/elasticache/replication_group_data_source_test.go b/internal/service/elasticache/replication_group_data_source_test.go index 6a4d98e0243..8ed72bcd723 100644 --- a/internal/service/elasticache/replication_group_data_source_test.go +++ b/internal/service/elasticache/replication_group_data_source_test.go @@ -35,6 +35,7 @@ func TestAccElastiCacheReplicationGroupDataSource_basic(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "auth_token_enabled", acctest.CtFalse), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttrPair(dataSourceName, "automatic_failover_enabled", resourceName, "automatic_failover_enabled"), + resource.TestCheckResourceAttrPair(dataSourceName, "cluster_mode", resourceName, "cluster_mode"), resource.TestCheckResourceAttrPair(dataSourceName, "multi_az_enabled", resourceName, "multi_az_enabled"), resource.TestCheckResourceAttrPair(dataSourceName, "member_clusters.#", resourceName, "member_clusters.#"), resource.TestCheckResourceAttrPair(dataSourceName, "node_type", resourceName, "node_type"), diff --git a/website/docs/d/elasticache_replication_group.html.markdown b/website/docs/d/elasticache_replication_group.html.markdown index 5675f0e8024..3cb56d5832f 100644 --- a/website/docs/d/elasticache_replication_group.html.markdown +++ b/website/docs/d/elasticache_replication_group.html.markdown @@ -32,6 +32,7 @@ This data source exports the following attributes in addition to the arguments a * `arn` - ARN of the created ElastiCache Replication Group. * `auth_token_enabled` - Whether an AuthToken (password) is enabled. * `automatic_failover_enabled` - A flag whether a read-only replica will be automatically promoted to read/write primary if the existing primary fails. +* `cluster_mode` - Whether cluster mode is enabled or disabled. * `node_type` – The cluster node type. * `num_cache_clusters` – The number of cache clusters that the replication group has. * `num_node_groups` - Number of node groups (shards) for the replication group.