From 1d04cdb9bc00aefb15130dddc7ff3c6eef92b180 Mon Sep 17 00:00:00 2001 From: Steve Hoeksema Date: Mon, 12 Sep 2016 06:13:58 +1200 Subject: [PATCH] Export AWS ELB service account ARN (#8700) --- .../providers/aws/data_source_aws_elb_service_account.go | 7 +++++++ .../aws/data_source_aws_elb_service_account_test.go | 2 ++ .../docs/providers/aws/d/elb_service_account.html.markdown | 1 + 3 files changed, 10 insertions(+) diff --git a/builtin/providers/aws/data_source_aws_elb_service_account.go b/builtin/providers/aws/data_source_aws_elb_service_account.go index 8101dac0945b..ae60e8b81f6b 100644 --- a/builtin/providers/aws/data_source_aws_elb_service_account.go +++ b/builtin/providers/aws/data_source_aws_elb_service_account.go @@ -32,6 +32,10 @@ func dataSourceAwsElbServiceAccount() *schema.Resource { Type: schema.TypeString, Optional: true, }, + "arn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, }, } } @@ -44,6 +48,9 @@ func dataSourceAwsElbServiceAccountRead(d *schema.ResourceData, meta interface{} if accid, ok := elbAccountIdPerRegionMap[region]; ok { d.SetId(accid) + + d.Set("arn", "arn:aws:iam::"+accid+":root") + return nil } diff --git a/builtin/providers/aws/data_source_aws_elb_service_account_test.go b/builtin/providers/aws/data_source_aws_elb_service_account_test.go index bf818fe88263..ef62e2b1d42b 100644 --- a/builtin/providers/aws/data_source_aws_elb_service_account_test.go +++ b/builtin/providers/aws/data_source_aws_elb_service_account_test.go @@ -15,12 +15,14 @@ func TestAccAWSElbServiceAccount_basic(t *testing.T) { Config: testAccCheckAwsElbServiceAccountConfig, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.aws_elb_service_account.main", "id", "797873946194"), + resource.TestCheckResourceAttr("data.aws_elb_service_account.main", "arn", "arn:aws:iam::797873946194:root"), ), }, resource.TestStep{ Config: testAccCheckAwsElbServiceAccountExplicitRegionConfig, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.aws_elb_service_account.regional", "id", "156460612806"), + resource.TestCheckResourceAttr("data.aws_elb_service_account.regional", "arn", "arn:aws:iam::156460612806:root"), ), }, }, diff --git a/website/source/docs/providers/aws/d/elb_service_account.html.markdown b/website/source/docs/providers/aws/d/elb_service_account.html.markdown index 178d7c3ad78d..4705cfe5027c 100644 --- a/website/source/docs/providers/aws/d/elb_service_account.html.markdown +++ b/website/source/docs/providers/aws/d/elb_service_account.html.markdown @@ -68,3 +68,4 @@ resource "aws_elb" "bar" { ## Attributes Reference * `id` - The ID of the AWS ELB service account in the selected region. +* `arn` - The ARN of the AWS ELB service account in the selected region.