aws: Implement naming changes for aws_elb_service_account
This commit is contained in:
parent
bb0baebfb7
commit
73791b47b3
|
@ -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",
|
"us-west-2": "797873946194",
|
||||||
}
|
}
|
||||||
|
|
||||||
func dataSourceAwsElbAccountId() *schema.Resource {
|
func dataSourceAwsElbServiceAccount() *schema.Resource {
|
||||||
return &schema.Resource{
|
return &schema.Resource{
|
||||||
Read: dataSourceAwsElbAccountIdRead,
|
Read: dataSourceAwsElbServiceAccountRead,
|
||||||
|
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"region": &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
|
region := meta.(*AWSClient).region
|
||||||
if v, ok := d.GetOk("region"); ok {
|
if v, ok := d.GetOk("region"); ok {
|
||||||
region = v.(string)
|
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_availability_zones": dataSourceAwsAvailabilityZones(),
|
||||||
"aws_caller_identity": dataSourceAwsCallerIdentity(),
|
"aws_caller_identity": dataSourceAwsCallerIdentity(),
|
||||||
"aws_ecs_container_definition": dataSourceAwsEcsContainerDefinition(),
|
"aws_ecs_container_definition": dataSourceAwsEcsContainerDefinition(),
|
||||||
"aws_elb_account_id": dataSourceAwsElbAccountId(),
|
"aws_elb_service_account": dataSourceAwsElbServiceAccount(),
|
||||||
"aws_iam_policy_document": dataSourceAwsIamPolicyDocument(),
|
"aws_iam_policy_document": dataSourceAwsIamPolicyDocument(),
|
||||||
"aws_ip_ranges": dataSourceAwsIPRanges(),
|
"aws_ip_ranges": dataSourceAwsIPRanges(),
|
||||||
"aws_redshift_service_account": dataSourceAwsRedshiftServiceAccount(),
|
"aws_redshift_service_account": dataSourceAwsRedshiftServiceAccount(),
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
---
|
---
|
||||||
layout: "aws"
|
layout: "aws"
|
||||||
page_title: "AWS: aws_elb_account_id"
|
page_title: "AWS: aws_elb_service_account"
|
||||||
sidebar_current: "docs-aws-datasource-elb-account-id"
|
sidebar_current: "docs-aws-datasource-elb-service-account"
|
||||||
description: |-
|
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.
|
in a given region for the purpose of whitelisting in S3 bucket policy.
|
||||||
|
|
||||||
## Example Usage
|
## Example Usage
|
||||||
|
|
||||||
```
|
```
|
||||||
data "aws_elb_account_id" "main" { }
|
data "aws_elb_service_account" "main" { }
|
||||||
|
|
||||||
resource "aws_s3_bucket" "elb_logs" {
|
resource "aws_s3_bucket" "elb_logs" {
|
||||||
bucket = "my-elb-tf-test-bucket"
|
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/*",
|
"Resource": "arn:aws:s3:::my-elb-tf-test-bucket/AWSLogs/*",
|
||||||
"Principal": {
|
"Principal": {
|
||||||
"AWS": [
|
"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
|
## 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
|
## 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") %>>
|
<li<%= sidebar_current("docs-aws-datasource-ecs-container-definition") %>>
|
||||||
<a href="/docs/providers/aws/d/ecs_container_definition.html">aws_ecs_container_definition</a>
|
<a href="/docs/providers/aws/d/ecs_container_definition.html">aws_ecs_container_definition</a>
|
||||||
</li>
|
</li>
|
||||||
<li<%= sidebar_current("docs-aws-datasource-elb-account-id") %>>
|
<li<%= sidebar_current("docs-aws-datasource-elb-service-account") %>>
|
||||||
<a href="/docs/providers/aws/d/elb_account_id.html">aws_elb_account_id</a>
|
<a href="/docs/providers/aws/d/elb_service_account.html">aws_elb_service_account</a>
|
||||||
</li>
|
</li>
|
||||||
<li<%= sidebar_current("docs-aws-datasource-iam-policy-document") %>>
|
<li<%= sidebar_current("docs-aws-datasource-iam-policy-document") %>>
|
||||||
<a href="/docs/providers/aws/d/iam_policy_document.html">aws_iam_policy_document</a>
|
<a href="/docs/providers/aws/d/iam_policy_document.html">aws_iam_policy_document</a>
|
||||||
|
|
Loading…
Reference in New Issue