github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/aws/d/billing_service_account.html.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  ```hcl
    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  
    22    policy = <<POLICY
    23  {
    24    "Id": "Policy",
    25    "Version": "2012-10-17",
    26    "Statement": [
    27      {
    28        "Action": [
    29          "s3:GetBucketAcl", "s3:GetBucketPolicy"
    30        ],
    31        "Effect": "Allow",
    32        "Resource": "arn:aws:s3:::my-billing-tf-test-bucket",
    33        "Principal": {
    34          "AWS": [
    35            "${data.aws_billing_service_account.main.id}"
    36          ]
    37        }
    38      },
    39      {
    40        "Action": [
    41          "s3:PutObject"
    42        ],
    43        "Effect": "Allow",
    44        "Resource": "arn:aws:s3:::my-billing-tf-test-bucket/AWSLogs/*",
    45        "Principal": {
    46          "AWS": [
    47            "${data.aws_billing_service_account.main.id}"
    48          ]
    49        }
    50      }
    51    ]
    52  }
    53  POLICY
    54  }
    55  ```
    56  
    57  
    58  ## Attributes Reference
    59  
    60  * `id` - The ID of the AWS billing service account.
    61  * `arn` - The ARN of the AWS billing service account.