Skip to content

Commit

Permalink
Merge pull request #15348 from angelabad/b-fix-aws_elasticache_replic…
Browse files Browse the repository at this point in the history
…ation_group-arn
  • Loading branch information
gdavison committed Jan 15, 2021
2 parents aa957b7 + 506c306 commit 3023eed
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 2 deletions.
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 @@ -21,6 +21,10 @@ func dataSourceAwsElasticacheReplicationGroup() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"arn": {
Type: schema.TypeString,
Computed: true,
},
"auth_token_enabled": {
Type: schema.TypeBool,
Computed: true,
Expand Down Expand Up @@ -95,6 +99,7 @@ func dataSourceAwsElasticacheReplicationGroupRead(d *schema.ResourceData, meta i

d.SetId(aws.StringValue(rg.ReplicationGroupId))
d.Set("replication_group_description", rg.Description)
d.Set("arn", rg.ARN)
d.Set("auth_token_enabled", rg.AuthTokenEnabled)
if rg.AutomaticFailover != nil {
switch aws.StringValue(rg.AutomaticFailover) {
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 @@ -22,6 +22,7 @@ func TestAccDataSourceAwsElasticacheReplicationGroup_basic(t *testing.T) {
Config: testAccDataSourceAwsElasticacheReplicationGroupConfig_basic(rName),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr(dataSourceName, "auth_token_enabled", "false"),
resource.TestCheckResourceAttrPair(dataSourceName, "arn", resourceName, "arn"),
resource.TestCheckResourceAttrPair(dataSourceName, "automatic_failover_enabled", resourceName, "automatic_failover_enabled"),
resource.TestCheckResourceAttrPair(dataSourceName, "member_clusters.#", resourceName, "member_clusters.#"),
resource.TestCheckResourceAttrPair(dataSourceName, "node_type", resourceName, "node_type"),
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 @@ -34,6 +34,10 @@ func resourceAwsElasticacheReplicationGroup() *schema.Resource {
Optional: true,
Computed: true,
},
"arn": {
Type: schema.TypeString,
Computed: true,
},
"at_rest_encryption_enabled": {
Type: schema.TypeBool,
Optional: true,
Expand Down Expand Up @@ -458,6 +462,7 @@ func resourceAwsElasticacheReplicationGroupRead(d *schema.ResourceData, meta int
}
d.Set("cluster_enabled", rgp.ClusterEnabled)
d.Set("replication_group_id", rgp.ReplicationGroupId)
d.Set("arn", rgp.ARN)

if rgp.NodeGroups != nil {
if len(rgp.NodeGroups[0].NodeGroupMembers) == 0 {
Expand Down
1 change: 1 addition & 0 deletions aws/resource_aws_elasticache_replication_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func TestAccAWSElasticacheReplicationGroup_basic(t *testing.T) {
Config: testAccAWSElasticacheReplicationGroupConfig(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSElasticacheReplicationGroupExists(resourceName, &rg),
testAccCheckResourceAttrRegionalARN(resourceName, "arn", "elasticache", fmt.Sprintf("replicationgroup:%s", rName)),
resource.TestCheckResourceAttr(resourceName, "number_cache_clusters", "2"),
resource.TestCheckResourceAttr(resourceName, "member_clusters.#", "2"),
resource.TestCheckResourceAttr(resourceName, "auto_minor_version_upgrade", "false"),
Expand Down
2 changes: 1 addition & 1 deletion website/docs/d/elasticache_replication_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ The following arguments are supported:

In addition to all arguments above, the following attributes are exported:

* `replication_group_id` - The identifier for the replication group.
* `replication_group_description` - The description of the replication group.
* `arn` - The Amazon Resource Name (ARN) of the created ElastiCache Replication Group.
* `auth_token_enabled` - A flag that enables using an AuthToken (password) when issuing Redis commands.
* `automatic_failover_enabled` - A flag whether a read-only replica will be automatically promoted to read/write primary if the existing primary fails.
* `node_type` – The cluster node type.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/elasticache_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ SNS topic to send ElastiCache notifications to. Example:

In addition to all arguments above, the following attributes are exported:

* `arn` - The ARN of the created ElastiCache Cluster.
* `cache_nodes` - List of node objects including `id`, `address`, `port` and `availability_zone`.
Referenceable e.g. as `${aws_elasticache_cluster.bar.cache_nodes.0.address}`

* `configuration_endpoint` - (Memcached only) The configuration endpoint to allow host discovery.
* `cluster_address` - (Memcached only) The DNS name of the cache cluster without the port appended.

Expand Down
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 @@ Cluster Mode (`cluster_mode`) supports the following:

In addition to all arguments above, the following attributes are exported:

* `arn` - The Amazon Resource Name (ARN) of the created ElastiCache Replication Group.
* `id` - The ID of the ElastiCache Replication Group.
* `cluster_enabled` - Indicates if cluster mode is enabled.
* `configuration_endpoint_address` - The address of the replication group configuration endpoint when cluster mode is enabled.
Expand Down

0 comments on commit 3023eed

Please sign in to comment.