Skip to content

Commit

Permalink
d/aws_elasticache_replication_group: Add cluster_mode attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Jul 17, 2024
1 parent d5883f6 commit f19f9f8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .changelog/38002.txt
Original file line number Diff line number Diff line change
@@ -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
```
9 changes: 6 additions & 3 deletions internal/service/elasticache/replication_group_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/elasticache_replication_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit f19f9f8

Please sign in to comment.