github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/providers/aws/d/elb_service_account.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_elb_service_account" 4 sidebar_current: "docs-aws-datasource-elb-service-account" 5 description: |- 6 Get AWS Elastic Load Balancing Service Account 7 --- 8 9 # aws\_elb\_service\_account 10 11 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) 12 in a given region for the purpose of whitelisting in S3 bucket policy. 13 14 ## Example Usage 15 16 ```hcl 17 data "aws_elb_service_account" "main" {} 18 19 resource "aws_s3_bucket" "elb_logs" { 20 bucket = "my-elb-tf-test-bucket" 21 acl = "private" 22 23 policy = <<POLICY 24 { 25 "Id": "Policy", 26 "Version": "2012-10-17", 27 "Statement": [ 28 { 29 "Action": [ 30 "s3:PutObject" 31 ], 32 "Effect": "Allow", 33 "Resource": "arn:aws:s3:::my-elb-tf-test-bucket/AWSLogs/*", 34 "Principal": { 35 "AWS": [ 36 "${data.aws_elb_service_account.main.arn}" 37 ] 38 } 39 } 40 ] 41 } 42 POLICY 43 } 44 45 resource "aws_elb" "bar" { 46 name = "my-foobar-terraform-elb" 47 availability_zones = ["us-west-2a"] 48 49 access_logs { 50 bucket = "${aws_s3_bucket.elb_logs.bucket}" 51 interval = 5 52 } 53 54 listener { 55 instance_port = 8000 56 instance_protocol = "http" 57 lb_port = 80 58 lb_protocol = "http" 59 } 60 } 61 ``` 62 63 ## Argument Reference 64 65 * `region` - (Optional) Name of the region whose AWS ELB account ID is desired. 66 Defaults to the region from the AWS provider configuration. 67 68 69 ## Attributes Reference 70 71 * `id` - The ID of the AWS ELB service account in the selected region. 72 * `arn` - The ARN of the AWS ELB service account in the selected region.