github.com/leeprovoost/terraform@v0.6.10-0.20160119085442-96f3f76118e7/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 resource "aws_cloudtrail" "foobar" { 16 name = "tf-trail-foobar" 17 s3_bucket_name = "${aws_s3_bucket.foo.id}" 18 s3_key_prefix = "/prefix" 19 include_global_service_events = false 20 } 21 22 resource "aws_s3_bucket" "foo" { 23 bucket = "tf-test-trail" 24 force_destroy = true 25 policy = <<POLICY 26 { 27 "Version": "2012-10-17", 28 "Statement": [ 29 { 30 "Sid": "AWSCloudTrailAclCheck", 31 "Effect": "Allow", 32 "Principal": { 33 "Service": "cloudtrail.amazonaws.com" 34 }, 35 "Action": "s3:GetBucketAcl", 36 "Resource": "arn:aws:s3:::tf-test-trail" 37 }, 38 { 39 "Sid": "AWSCloudTrailWrite", 40 "Effect": "Allow", 41 "Principal": { 42 "Service": "cloudtrail.amazonaws.com" 43 }, 44 "Action": "s3:PutObject", 45 "Resource": "arn:aws:s3:::tf-test-trail/*", 46 "Condition": { 47 "StringEquals": { 48 "s3:x-amz-acl": "bucket-owner-full-control" 49 } 50 } 51 } 52 ] 53 } 54 POLICY 55 } 56 ``` 57 58 ## Argument Reference 59 60 The following arguments are supported: 61 62 * `name` - (Required) Specifies the name of the trail. 63 * `s3_bucket_name` - (Required) Specifies the name of the S3 bucket designated for publishing log files. 64 * `s3_key_prefix` - (Optional) Specifies the S3 key prefix that precedes 65 the name of the bucket you have designated for log file delivery. 66 * `cloud_watch_logs_role_arn` - (Optional) Specifies the role for the CloudWatch Logs 67 endpoint to assume to write to a user’s log group. 68 * `cloud_watch_logs_group_arn` - (Optional) Specifies a log group name using an Amazon Resource Name (ARN), 69 that represents the log group to which CloudTrail logs will be delivered. 70 * `enable_logging` - (Optional) Enables logging for the trail. Defaults to `true`. 71 Setting this to `false` will pause logging. 72 * `include_global_service_events` - (Optional) Specifies whether the trail is publishing events 73 from global services such as IAM to the log files. Defaults to `true`. 74 * `sns_topic_name` - (Optional) Specifies the name of the Amazon SNS topic 75 defined for notification of log file delivery. 76 77 ## Attribute Reference 78 79 The following attributes are exported: 80 81 * `id` - The name of the trail.