github.com/rhenning/terraform@v0.8.0-beta2/website/source/docs/providers/aws/d/billing_service_account.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_billing_service_account"
     4  sidebar_current: "docs-aws-datasource-billing-service-account"
     5  description: |-
     6    Get AWS Billing Service Account
     7  ---
     8  
     9  # aws\_billing\_service\_account
    10  
    11  Use this data source to get the Account ID of the [AWS Billing and Cost Management Service Account](http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/billing-getting-started.html#step-2) for the purpose of whitelisting in S3 bucket policy.
    12  
    13  ## Example Usage
    14  
    15  ```
    16  data "aws_billing_service_account" "main" { }
    17  
    18  resource "aws_s3_bucket" "billing_logs" {
    19      bucket = "my-billing-tf-test-bucket"
    20      acl = "private"
    21      policy = <<POLICY
    22  {
    23    "Id": "Policy",
    24    "Version": "2012-10-17",
    25    "Statement": [
    26      {
    27        "Action": [
    28          "s3:GetBucketAcl", "s3:GetBucketPolicy"
    29        ],
    30        "Effect": "Allow",
    31        "Resource": "arn:aws:s3:::my-billing-tf-test-bucket",
    32        "Principal": {
    33          "AWS": [
    34            "${data.aws_billing_service_account.main.id}"
    35          ]
    36        }
    37      },
    38      {
    39        "Action": [
    40          "s3:PutObject"
    41        ],
    42        "Effect": "Allow",
    43        "Resource": "arn:aws:s3:::my-billing-tf-test-bucket/AWSLogs/*",
    44        "Principal": {
    45          "AWS": [
    46            "${data.aws_billing_service_account.main.id}"
    47          ]
    48        }
    49      }
    50    ]
    51  }
    52  POLICY
    53  }
    54  ```
    55  
    56  
    57  ## Attributes Reference
    58  
    59  * `id` - The ID of the AWS billing service account.
    60  * `arn` - The ARN of the AWS billing service account.