github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/aws/r/cloudtrail.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: cloudtrail"
     4  sidebar_current: "docs-aws-resource-cloudtrail"
     5  description: |-
     6    Provides a CloudTrail resource.
     7  ---
     8  
     9  # aws\_cloudtrail
    10  
    11  Provides a CloudTrail resource.
    12  
    13  ## Example Usage
    14  
    15  ```hcl
    16  resource "aws_cloudtrail" "foobar" {
    17    name                          = "tf-trail-foobar"
    18    s3_bucket_name                = "${aws_s3_bucket.foo.id}"
    19    s3_key_prefix                 = "prefix"
    20    include_global_service_events = false
    21  }
    22  
    23  resource "aws_s3_bucket" "foo" {
    24    bucket        = "tf-test-trail"
    25    force_destroy = true
    26  
    27    policy = <<POLICY
    28  {
    29      "Version": "2012-10-17",
    30      "Statement": [
    31          {
    32              "Sid": "AWSCloudTrailAclCheck",
    33              "Effect": "Allow",
    34              "Principal": {
    35                "Service": "cloudtrail.amazonaws.com"
    36              },
    37              "Action": "s3:GetBucketAcl",
    38              "Resource": "arn:aws:s3:::tf-test-trail"
    39          },
    40          {
    41              "Sid": "AWSCloudTrailWrite",
    42              "Effect": "Allow",
    43              "Principal": {
    44                "Service": "cloudtrail.amazonaws.com"
    45              },
    46              "Action": "s3:PutObject",
    47              "Resource": "arn:aws:s3:::tf-test-trail/*",
    48              "Condition": {
    49                  "StringEquals": {
    50                      "s3:x-amz-acl": "bucket-owner-full-control"
    51                  }
    52              }
    53          }
    54      ]
    55  }
    56  POLICY
    57  }
    58  ```
    59  
    60  ## Argument Reference
    61  
    62  The following arguments are supported:
    63  
    64  * `name` - (Required) Specifies the name of the trail.
    65  * `s3_bucket_name` - (Required) Specifies the name of the S3 bucket designated for publishing log files.
    66  * `s3_key_prefix` - (Optional) Specifies the S3 key prefix that precedes
    67      the name of the bucket you have designated for log file delivery.
    68  * `cloud_watch_logs_role_arn` - (Optional) Specifies the role for the CloudWatch Logs
    69      endpoint to assume to write to a user’s log group.
    70  * `cloud_watch_logs_group_arn` - (Optional) Specifies a log group name using an Amazon Resource Name (ARN),
    71      that represents the log group to which CloudTrail logs will be delivered.
    72  * `enable_logging` - (Optional) Enables logging for the trail. Defaults to `true`.
    73      Setting this to `false` will pause logging.
    74  * `include_global_service_events` - (Optional) Specifies whether the trail is publishing events
    75      from global services such as IAM to the log files. Defaults to `true`.
    76  * `is_multi_region_trail` - (Optional) Specifies whether the trail is created in the current
    77      region or in all regions. Defaults to `false`.
    78  * `sns_topic_name` - (Optional) Specifies the name of the Amazon SNS topic
    79      defined for notification of log file delivery.
    80  * `enable_log_file_validation` - (Optional) Specifies whether log file integrity validation is enabled.
    81      Defaults to `false`.
    82  * `kms_key_id` - (Optional) Specifies the KMS key ARN to use to encrypt the logs delivered by CloudTrail.
    83  * `tags` - (Optional) A mapping of tags to assign to the trail
    84  
    85  ## Attribute Reference
    86  
    87  The following attributes are exported:
    88  
    89  * `id` - The name of the trail.
    90  * `home_region` - The region in which the trail was created.
    91  * `arn` - The Amazon Resource Name of the trail.
    92  
    93  
    94  ## Import
    95  
    96  Cloudtrails can be imported using the `name`, e.g.
    97  
    98  ```
    99  $ terraform import aws_cloudtrail.sample my-sample-trail
   100  ```