Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws: Implement naming changes for aws_elb_service_account #8242

Merged
merged 1 commit into from
Aug 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions builtin/providers/aws/data_source_aws_elb_account_id_test.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ var elbAccountIdPerRegionMap = map[string]string{
"us-west-2": "797873946194",
}

func dataSourceAwsElbAccountId() *schema.Resource {
func dataSourceAwsElbServiceAccount() *schema.Resource {
return &schema.Resource{
Read: dataSourceAwsElbAccountIdRead,
Read: dataSourceAwsElbServiceAccountRead,

Schema: map[string]*schema.Schema{
"region": &schema.Schema{
Expand All @@ -36,7 +36,7 @@ func dataSourceAwsElbAccountId() *schema.Resource {
}
}

func dataSourceAwsElbAccountIdRead(d *schema.ResourceData, meta interface{}) error {
func dataSourceAwsElbServiceAccountRead(d *schema.ResourceData, meta interface{}) error {
region := meta.(*AWSClient).region
if v, ok := d.GetOk("region"); ok {
region = v.(string)
Expand Down
38 changes: 38 additions & 0 deletions builtin/providers/aws/data_source_aws_elb_service_account_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package aws

import (
"testing"

"github.com/hashicorp/terraform/helper/resource"
)

func TestAccAWSElbServiceAccount_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccCheckAwsElbServiceAccountConfig,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.aws_elb_service_account.main", "id", "797873946194"),
),
},
resource.TestStep{
Config: testAccCheckAwsElbServiceAccountExplicitRegionConfig,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.aws_elb_service_account.regional", "id", "156460612806"),
),
},
},
})
}

const testAccCheckAwsElbServiceAccountConfig = `
data "aws_elb_service_account" "main" { }
`

const testAccCheckAwsElbServiceAccountExplicitRegionConfig = `
data "aws_elb_service_account" "regional" {
region = "eu-west-1"
}
`
2 changes: 1 addition & 1 deletion builtin/providers/aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func Provider() terraform.ResourceProvider {
"aws_availability_zones": dataSourceAwsAvailabilityZones(),
"aws_caller_identity": dataSourceAwsCallerIdentity(),
"aws_ecs_container_definition": dataSourceAwsEcsContainerDefinition(),
"aws_elb_account_id": dataSourceAwsElbAccountId(),
"aws_elb_service_account": dataSourceAwsElbServiceAccount(),
"aws_iam_policy_document": dataSourceAwsIamPolicyDocument(),
"aws_ip_ranges": dataSourceAwsIPRanges(),
"aws_redshift_service_account": dataSourceAwsRedshiftServiceAccount(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
layout: "aws"
page_title: "AWS: aws_elb_account_id"
sidebar_current: "docs-aws-datasource-elb-account-id"
page_title: "AWS: aws_elb_service_account"
sidebar_current: "docs-aws-datasource-elb-service-account"
description: |-
Get AWS Elastic Load Balancing Account ID
Get AWS Elastic Load Balancing Service Account
---

# aws\_elb\_account\_id
# aws\_elb\_service\_account

Use this data source to get the Account ID of the [AWS Elastic Load Balancing Account](http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-access-logs.html#attach-bucket-policy)
Use this data source to get the Account ID of the [AWS Elastic Load Balancing Service Account](http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-access-logs.html#attach-bucket-policy)
in a given region for the purpose of whitelisting in S3 bucket policy.

## Example Usage

```
data "aws_elb_account_id" "main" { }
data "aws_elb_service_account" "main" { }

resource "aws_s3_bucket" "elb_logs" {
bucket = "my-elb-tf-test-bucket"
Expand All @@ -32,7 +32,7 @@ resource "aws_s3_bucket" "elb_logs" {
"Resource": "arn:aws:s3:::my-elb-tf-test-bucket/AWSLogs/*",
"Principal": {
"AWS": [
"${data.aws_elb_account_id.main.id}"
"${data.aws_elb_service_account.main.id}"
]
}
}
Expand Down Expand Up @@ -61,9 +61,10 @@ resource "aws_elb" "bar" {

## Argument Reference

* `region` - (Optional) Region of a given AWS ELB Account
* `region` - (Optional) Name of the region whose AWS ELB account ID is desired.
Defaults to the region from the AWS provider configuration.


## Attributes Reference

* `id` - Account ID
* `id` - The ID of the AWS ELB service account in the selected region.
4 changes: 2 additions & 2 deletions website/source/layouts/aws.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<li<%= sidebar_current("docs-aws-datasource-ecs-container-definition") %>>
<a href="/docs/providers/aws/d/ecs_container_definition.html">aws_ecs_container_definition</a>
</li>
<li<%= sidebar_current("docs-aws-datasource-elb-account-id") %>>
<a href="/docs/providers/aws/d/elb_account_id.html">aws_elb_account_id</a>
<li<%= sidebar_current("docs-aws-datasource-elb-service-account") %>>
<a href="/docs/providers/aws/d/elb_service_account.html">aws_elb_service_account</a>
</li>
<li<%= sidebar_current("docs-aws-datasource-iam-policy-document") %>>
<a href="/docs/providers/aws/d/iam_policy_document.html">aws_iam_policy_document</a>
Expand Down