From daac877c829c2c3b67dffae87723e83f3334c14f Mon Sep 17 00:00:00 2001 From: Clint Date: Sat, 27 Aug 2016 09:20:11 -0500 Subject: [PATCH] provider/aws: Get and export ASG ARN value (#8503) --- builtin/providers/aws/resource_aws_autoscaling_group.go | 6 ++++++ .../providers/aws/resource_aws_autoscaling_group_test.go | 2 ++ .../docs/providers/aws/r/autoscaling_group.html.markdown | 1 + 3 files changed, 9 insertions(+) diff --git a/builtin/providers/aws/resource_aws_autoscaling_group.go b/builtin/providers/aws/resource_aws_autoscaling_group.go index 2dc460dee..a10c96cb4 100644 --- a/builtin/providers/aws/resource_aws_autoscaling_group.go +++ b/builtin/providers/aws/resource_aws_autoscaling_group.go @@ -176,6 +176,11 @@ func resourceAwsAutoscalingGroup() *schema.Resource { Set: schema.HashString, }, + "arn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "tag": autoscalingTagsSchema(), }, } @@ -285,6 +290,7 @@ func resourceAwsAutoscalingGroupRead(d *schema.ResourceData, meta interface{}) e d.Set("availability_zones", flattenStringList(g.AvailabilityZones)) d.Set("default_cooldown", g.DefaultCooldown) + d.Set("arn", g.AutoScalingGroupARN) d.Set("desired_capacity", g.DesiredCapacity) d.Set("health_check_grace_period", g.HealthCheckGracePeriod) d.Set("health_check_type", g.HealthCheckType) diff --git a/builtin/providers/aws/resource_aws_autoscaling_group_test.go b/builtin/providers/aws/resource_aws_autoscaling_group_test.go index 716042dba..a5fc59152 100644 --- a/builtin/providers/aws/resource_aws_autoscaling_group_test.go +++ b/builtin/providers/aws/resource_aws_autoscaling_group_test.go @@ -96,6 +96,8 @@ func TestAccAWSAutoScalingGroup_autoGeneratedName(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestMatchResourceAttr( "aws_autoscaling_group.bar", "name", asgNameRegexp), + resource.TestCheckResourceAttrSet( + "aws_autoscaling_group.bar", "arn"), ), }, }, diff --git a/website/source/docs/providers/aws/r/autoscaling_group.html.markdown b/website/source/docs/providers/aws/r/autoscaling_group.html.markdown index d11062cb5..faf5ab3cb 100644 --- a/website/source/docs/providers/aws/r/autoscaling_group.html.markdown +++ b/website/source/docs/providers/aws/r/autoscaling_group.html.markdown @@ -104,6 +104,7 @@ Tags support the following: The following attributes are exported: * `id` - The autoscaling group name. +* `arn` - The ARN for this AutoScaling Group * `availability_zones` - The availability zones of the autoscale group. * `min_size` - The minimum size of the autoscale group * `max_size` - The maximum size of the autoscale group