Skip to content

Commit

Permalink
Export AWS ELB service account ARN (#8700)
Browse files Browse the repository at this point in the history
  • Loading branch information
steveh authored and radeksimko committed Sep 11, 2016
1 parent 291f298 commit 1d04cdb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions builtin/providers/aws/data_source_aws_elb_service_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ func dataSourceAwsElbServiceAccount() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"arn": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
},
}
}
Expand All @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 1d04cdb

Please sign in to comment.