Skip to content

Commit 1d04cdb

Browse files
stevehradeksimko
authored andcommitted
Export AWS ELB service account ARN (hashicorp#8700)
1 parent 291f298 commit 1d04cdb

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

builtin/providers/aws/data_source_aws_elb_service_account.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ func dataSourceAwsElbServiceAccount() *schema.Resource {
3232
Type: schema.TypeString,
3333
Optional: true,
3434
},
35+
"arn": &schema.Schema{
36+
Type: schema.TypeString,
37+
Computed: true,
38+
},
3539
},
3640
}
3741
}
@@ -44,6 +48,9 @@ func dataSourceAwsElbServiceAccountRead(d *schema.ResourceData, meta interface{}
4448

4549
if accid, ok := elbAccountIdPerRegionMap[region]; ok {
4650
d.SetId(accid)
51+
52+
d.Set("arn", "arn:aws:iam::"+accid+":root")
53+
4754
return nil
4855
}
4956

builtin/providers/aws/data_source_aws_elb_service_account_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ func TestAccAWSElbServiceAccount_basic(t *testing.T) {
1515
Config: testAccCheckAwsElbServiceAccountConfig,
1616
Check: resource.ComposeTestCheckFunc(
1717
resource.TestCheckResourceAttr("data.aws_elb_service_account.main", "id", "797873946194"),
18+
resource.TestCheckResourceAttr("data.aws_elb_service_account.main", "arn", "arn:aws:iam::797873946194:root"),
1819
),
1920
},
2021
resource.TestStep{
2122
Config: testAccCheckAwsElbServiceAccountExplicitRegionConfig,
2223
Check: resource.ComposeTestCheckFunc(
2324
resource.TestCheckResourceAttr("data.aws_elb_service_account.regional", "id", "156460612806"),
25+
resource.TestCheckResourceAttr("data.aws_elb_service_account.regional", "arn", "arn:aws:iam::156460612806:root"),
2426
),
2527
},
2628
},

website/source/docs/providers/aws/d/elb_service_account.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,4 @@ resource "aws_elb" "bar" {
6868
## Attributes Reference
6969

7070
* `id` - The ID of the AWS ELB service account in the selected region.
71+
* `arn` - The ARN of the AWS ELB service account in the selected region.

0 commit comments

Comments
 (0)