Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/aws_elasticache_replication_group: Add reader_endpoint_address attribute #9979

Merged
merged 6 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions aws/data_source_aws_elasticache_replication_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ func dataSourceAwsElasticacheReplicationGroup() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"reader_endpoint_address": {
Type: schema.TypeString,
Computed: true,
},
"number_cache_clusters": {
Type: schema.TypeInt,
Computed: true,
Expand Down Expand Up @@ -110,6 +114,7 @@ func dataSourceAwsElasticacheReplicationGroupRead(d *schema.ResourceData, meta i
}
d.Set("port", rg.NodeGroups[0].PrimaryEndpoint.Port)
d.Set("primary_endpoint_address", rg.NodeGroups[0].PrimaryEndpoint.Address)
d.Set("reader_endpoint_address", rg.NodeGroups[0].ReaderEndpoint.Address)
}
d.Set("number_cache_clusters", len(rg.MemberClusters))
if err := d.Set("member_clusters", flattenStringList(rg.MemberClusters)); err != nil {
Expand Down
1 change: 1 addition & 0 deletions aws/data_source_aws_elasticache_replication_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func TestAccDataSourceAwsElasticacheReplicationGroup_basic(t *testing.T) {
resource.TestCheckResourceAttrPair(dataSourceName, "number_cache_clusters", resourceName, "number_cache_clusters"),
resource.TestCheckResourceAttrPair(dataSourceName, "port", resourceName, "port"),
resource.TestCheckResourceAttrPair(dataSourceName, "primary_endpoint_address", resourceName, "primary_endpoint_address"),
resource.TestCheckResourceAttrPair(dataSourceName, "reader_endpoint_address", resourceName, "reader_endpoint_address"),
resource.TestCheckResourceAttrPair(dataSourceName, "replication_group_description", resourceName, "replication_group_description"),
resource.TestCheckResourceAttrPair(dataSourceName, "replication_group_id", resourceName, "replication_group_id"),
resource.TestCheckResourceAttrPair(dataSourceName, "snapshot_window", resourceName, "snapshot_window"),
Expand Down
5 changes: 5 additions & 0 deletions aws/resource_aws_elasticache_replication_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ func resourceAwsElasticacheReplicationGroup() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"reader_endpoint_address": {
Type: schema.TypeString,
Computed: true,
},
"replication_group_description": {
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -489,6 +493,7 @@ func resourceAwsElasticacheReplicationGroupRead(d *schema.ResourceData, meta int
} else {
d.Set("port", rgp.NodeGroups[0].PrimaryEndpoint.Port)
d.Set("primary_endpoint_address", rgp.NodeGroups[0].PrimaryEndpoint.Address)
d.Set("reader_endpoint_address", rgp.NodeGroups[0].ReaderEndpoint.Address)
}

d.Set("auto_minor_version_upgrade", c.AutoMinorVersionUpgrade)
Expand Down
4 changes: 4 additions & 0 deletions aws/resource_aws_elasticache_replication_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ func TestAccAWSElasticacheReplicationGroup_multiAzInVpc(t *testing.T) {
resourceName, "snapshot_retention_limit", "7"),
resource.TestCheckResourceAttrSet(
resourceName, "primary_endpoint_address"),
resource.TestCheckResourceAttrSet(
resourceName, "reader_endpoint_address"),
),
},
{
Expand Down Expand Up @@ -363,6 +365,8 @@ func TestAccAWSElasticacheReplicationGroup_redisClusterInVpc2(t *testing.T) {
resourceName, "snapshot_retention_limit", "7"),
resource.TestCheckResourceAttrSet(
resourceName, "primary_endpoint_address"),
resource.TestCheckResourceAttrSet(
resourceName, "reader_endpoint_address"),
),
},
{
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 @@ -40,3 +40,4 @@ In addition to all arguments above, the following attributes are exported:
* `port` – The port number on which the configuration endpoint will accept connections.
* `configuration_endpoint_address` - The configuration endpoint address to allow host discovery.
* `primary_endpoint_address` - The endpoint of the primary node in this node group (shard).
* `reader_endpoint_address` - The endpoint of the reader node in this node group (shard).
1 change: 1 addition & 0 deletions website/docs/r/elasticache_replication_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ In addition to all arguments above, the following attributes are exported:
* `id` - The ID of the ElastiCache Replication Group.
* `configuration_endpoint_address` - The address of the replication group configuration endpoint when cluster mode is enabled.
* `primary_endpoint_address` - (Redis only) The address of the endpoint for the primary node in the replication group, if the cluster mode is disabled.
* `reader_endpoint_address` - (Redis only) The address of the endpoint for the reader node in the replication group, if the cluster mode is disabled.
* `member_clusters` - The identifiers of all the nodes that are part of this replication group.

## Timeouts
Expand Down