From 820f72d86a3f6b8b09af6affad8f1df48a1443b2 Mon Sep 17 00:00:00 2001 From: Angel Abad Date: Thu, 24 Sep 2020 17:39:04 +0200 Subject: [PATCH] resource_aws_elasticache_replication_group: Add arn attribute --- aws/resource_aws_elasticache_replication_group.go | 14 ++++++++++++++ website/docs/r/elasticache_cluster.html.markdown | 2 +- .../r/elasticache_replication_group.html.markdown | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/aws/resource_aws_elasticache_replication_group.go b/aws/resource_aws_elasticache_replication_group.go index a72737d5e3cc..5d3732fc113a 100644 --- a/aws/resource_aws_elasticache_replication_group.go +++ b/aws/resource_aws_elasticache_replication_group.go @@ -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, @@ -521,6 +525,16 @@ func resourceAwsElasticacheReplicationGroupRead(d *schema.ResourceData, meta int } } + arn := arn.ARN{ + Partition: meta.(*AWSClient).partition, + Service: "elasticache", + Region: meta.(*AWSClient).region, + AccountID: meta.(*AWSClient).accountid, + Resource: fmt.Sprintf("replicationgroup:%s", d.Id()), + }.String() + + d.Set("arn", arn) + return nil } diff --git a/website/docs/r/elasticache_cluster.html.markdown b/website/docs/r/elasticache_cluster.html.markdown index f68a2d5c79b3..cb1e8810f0e5 100644 --- a/website/docs/r/elasticache_cluster.html.markdown +++ b/website/docs/r/elasticache_cluster.html.markdown @@ -138,9 +138,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. diff --git a/website/docs/r/elasticache_replication_group.html.markdown b/website/docs/r/elasticache_replication_group.html.markdown index b1ff694a7920..5a8b83cd5414 100644 --- a/website/docs/r/elasticache_replication_group.html.markdown +++ b/website/docs/r/elasticache_replication_group.html.markdown @@ -146,6 +146,7 @@ Cluster Mode (`cluster_mode`) supports the following: In addition to all arguments above, the following attributes are exported: +* `arn` - The ARN of the created ElastiCache Replication Group. * `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.