From 62bdba4fd77e83534fa0fc31fcde43ea89a1f72a Mon Sep 17 00:00:00 2001 From: 1newsr Date: Tue, 3 Sep 2019 20:33:01 +0900 Subject: [PATCH 1/4] Add reader_endpoint_address to aws_elasticache_replication_group --- aws/data_source_aws_elasticache_replication_group.go | 5 +++++ aws/data_source_aws_elasticache_replication_group_test.go | 1 + aws/resource_aws_elasticache_replication_group.go | 5 +++++ aws/resource_aws_elasticache_replication_group_test.go | 4 ++++ website/docs/d/elasticache_replication_group.html.markdown | 1 + website/docs/r/elasticache_replication_group.html.markdown | 1 + 6 files changed, 17 insertions(+) diff --git a/aws/data_source_aws_elasticache_replication_group.go b/aws/data_source_aws_elasticache_replication_group.go index 7c3ee5e2ca5..ab129fbf4f0 100644 --- a/aws/data_source_aws_elasticache_replication_group.go +++ b/aws/data_source_aws_elasticache_replication_group.go @@ -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, @@ -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 { diff --git a/aws/data_source_aws_elasticache_replication_group_test.go b/aws/data_source_aws_elasticache_replication_group_test.go index d948bded24a..db0354279f7 100644 --- a/aws/data_source_aws_elasticache_replication_group_test.go +++ b/aws/data_source_aws_elasticache_replication_group_test.go @@ -23,6 +23,7 @@ func TestAccDataSourceAwsElasticacheReplicationGroup_basic(t *testing.T) { resource.TestCheckResourceAttr("data.aws_elasticache_replication_group.bar", "automatic_failover_enabled", "true"), resource.TestCheckResourceAttr("data.aws_elasticache_replication_group.bar", "port", "6379"), resource.TestCheckResourceAttrSet("data.aws_elasticache_replication_group.bar", "primary_endpoint_address"), + resource.TestCheckResourceAttrSet("data.aws_elasticache_replication_group.bar", "reader_endpoint_address"), resource.TestCheckResourceAttr("data.aws_elasticache_replication_group.bar", "number_cache_clusters", "2"), resource.TestCheckResourceAttr("data.aws_elasticache_replication_group.bar", "member_clusters.#", "2"), resource.TestCheckResourceAttr("data.aws_elasticache_replication_group.bar", "node_type", "cache.m1.small"), diff --git a/aws/resource_aws_elasticache_replication_group.go b/aws/resource_aws_elasticache_replication_group.go index 44d96fdf382..d1ad13ce25b 100644 --- a/aws/resource_aws_elasticache_replication_group.go +++ b/aws/resource_aws_elasticache_replication_group.go @@ -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, @@ -472,6 +476,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) diff --git a/aws/resource_aws_elasticache_replication_group_test.go b/aws/resource_aws_elasticache_replication_group_test.go index 98aabf2ed44..7cd85d6a721 100644 --- a/aws/resource_aws_elasticache_replication_group_test.go +++ b/aws/resource_aws_elasticache_replication_group_test.go @@ -304,6 +304,8 @@ func TestAccAWSElasticacheReplicationGroup_multiAzInVpc(t *testing.T) { "aws_elasticache_replication_group.bar", "snapshot_retention_limit", "7"), resource.TestCheckResourceAttrSet( "aws_elasticache_replication_group.bar", "primary_endpoint_address"), + resource.TestCheckResourceAttrSet( + "aws_elasticache_replication_group.bar", "reader_endpoint_address"), ), }, }, @@ -331,6 +333,8 @@ func TestAccAWSElasticacheReplicationGroup_redisClusterInVpc2(t *testing.T) { "aws_elasticache_replication_group.bar", "snapshot_retention_limit", "7"), resource.TestCheckResourceAttrSet( "aws_elasticache_replication_group.bar", "primary_endpoint_address"), + resource.TestCheckResourceAttrSet( + "aws_elasticache_replication_group.bar", "reader_endpoint_address"), ), }, }, diff --git a/website/docs/d/elasticache_replication_group.html.markdown b/website/docs/d/elasticache_replication_group.html.markdown index ec0f9d71c6c..4c043469322 100644 --- a/website/docs/d/elasticache_replication_group.html.markdown +++ b/website/docs/d/elasticache_replication_group.html.markdown @@ -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). diff --git a/website/docs/r/elasticache_replication_group.html.markdown b/website/docs/r/elasticache_replication_group.html.markdown index 0cc0e42bbbd..cf1ce1a5b14 100644 --- a/website/docs/r/elasticache_replication_group.html.markdown +++ b/website/docs/r/elasticache_replication_group.html.markdown @@ -148,6 +148,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 From 65365bcf7239b59dbf7fd9bf354470827f2979bb Mon Sep 17 00:00:00 2001 From: 1newsr <35871065+1newsr@users.noreply.github.com> Date: Tue, 26 Nov 2019 08:30:04 +0900 Subject: [PATCH 2/4] Fix format --- aws/resource_aws_elasticache_replication_group_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/resource_aws_elasticache_replication_group_test.go b/aws/resource_aws_elasticache_replication_group_test.go index 7d253b4aecb..ab60dd3c2a2 100644 --- a/aws/resource_aws_elasticache_replication_group_test.go +++ b/aws/resource_aws_elasticache_replication_group_test.go @@ -382,7 +382,7 @@ func TestAccAWSElasticacheReplicationGroup_redisClusterInVpc2(t *testing.T) { resourceName, "snapshot_retention_limit", "7"), resource.TestCheckResourceAttrSet( resourceName, "primary_endpoint_address"), - resource.TestCheckResourceAttrSet( + resource.TestCheckResourceAttrSet( resourceName, "reader_endpoint_address"), ), }, From 10d2deb951ac449d9a49387bfdb5a29fc1c88170 Mon Sep 17 00:00:00 2001 From: 1newsr <35871065+1newsr@users.noreply.github.com> Date: Tue, 26 Nov 2019 08:31:43 +0900 Subject: [PATCH 3/4] Fix format --- aws/resource_aws_elasticache_replication_group_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/resource_aws_elasticache_replication_group_test.go b/aws/resource_aws_elasticache_replication_group_test.go index ab60dd3c2a2..6f7d32694b3 100644 --- a/aws/resource_aws_elasticache_replication_group_test.go +++ b/aws/resource_aws_elasticache_replication_group_test.go @@ -345,7 +345,7 @@ func TestAccAWSElasticacheReplicationGroup_multiAzInVpc(t *testing.T) { resourceName, "snapshot_retention_limit", "7"), resource.TestCheckResourceAttrSet( resourceName, "primary_endpoint_address"), - resource.TestCheckResourceAttrSet( + resource.TestCheckResourceAttrSet( resourceName, "reader_endpoint_address"), ), }, From 50c348f0cedc53745782d947d4bc230b4f203e45 Mon Sep 17 00:00:00 2001 From: 1newsr <35871065+1newsr@users.noreply.github.com> Date: Wed, 3 Jun 2020 18:08:04 +0900 Subject: [PATCH 4/4] fix fmt --- aws/resource_aws_elasticache_replication_group_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/resource_aws_elasticache_replication_group_test.go b/aws/resource_aws_elasticache_replication_group_test.go index d3afcdc1c42..fc19b982530 100644 --- a/aws/resource_aws_elasticache_replication_group_test.go +++ b/aws/resource_aws_elasticache_replication_group_test.go @@ -365,7 +365,7 @@ func TestAccAWSElasticacheReplicationGroup_redisClusterInVpc2(t *testing.T) { resourceName, "snapshot_retention_limit", "7"), resource.TestCheckResourceAttrSet( resourceName, "primary_endpoint_address"), - resource.TestCheckResourceAttrSet( + resource.TestCheckResourceAttrSet( resourceName, "reader_endpoint_address"), ), },