Merge pull request #8242 from TimeIncOSS/f-aws-elb-svc-acc-fix
aws: Implement naming changes for aws_elb_service_account
This commit is contained in:
commit
73f685a8b6
|
@ -1,38 +0,0 @@
|
|||
package aws
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccAWSElbAccountId_basic(t *testing.T) {
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
Config: testAccCheckAwsElbAccountIdConfig,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
resource.TestCheckResourceAttr("data.aws_elb_account_id.main", "id", "797873946194"),
|
||||
),
|
||||
},
|
||||
resource.TestStep{
|
||||
Config: testAccCheckAwsElbAccountIdExplicitRegionConfig,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
resource.TestCheckResourceAttr("data.aws_elb_account_id.regional", "id", "156460612806"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const testAccCheckAwsElbAccountIdConfig = `
|
||||
data "aws_elb_account_id" "main" { }
|
||||
`
|
||||
|
||||
const testAccCheckAwsElbAccountIdExplicitRegionConfig = `
|
||||
data "aws_elb_account_id" "regional" {
|
||||
region = "eu-west-1"
|
||||
}
|
||||
`
|
|
@ -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{
|
||||
|
@ -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)
|
|
@ -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"
|
||||
}
|
||||
`
|
|
@ -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(),
|
||||
|
|
|
@ -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"
|
||||
|
@ -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}"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue