Resource
aws.s3.BucketLogging
Example
let caller = read aws.sts.CallerIdentity {}
let source_bucket = aws.s3.Bucket {
bucket = 'carina-example-logging-source'
tags = {
Environment = 'example'
}
}
let log_bucket = aws.s3.Bucket {
bucket = 'carina-example-logging-destination'
tags = {
Environment = 'example'
}
}
let log_bucket_policy = aws.s3.BucketPolicy {
bucket = log_bucket.bucket
policy = {
version = aws.iam.PolicyDocument.Version.2012_10_17
statement {
sid = 'AllowS3LogDelivery'
effect = aws.iam.PolicyDocument.Statement.Effect.allow
principal = {
service = 'logging.s3.amazonaws.com'
}
action = 's3:PutObject'
resource = ["/access-logs/*"]
condition = {
arn_like = {
'aws:SourceArn' = source_bucket.arn
}
string_equals = {
'aws:SourceAccount' = caller.account_id
}
}
}
}
}
aws.s3.BucketLogging {
bucket = source_bucket.bucket
target_bucket = log_bucket_policy.bucket
target_prefix = 'access-logs/'
}
Argument Reference
bucket
- Type:
String - Required: Yes
The name of the bucket for which to set the logging parameters.
target_bucket
- Type:
String - Required: Yes
Destination bucket for server access logs.
target_prefix
- Type:
String - Required: No
Key prefix to apply to log objects.
target_object_key_format
- Type: Struct(TargetObjectKeyFormat)
- Required: No
Partitioning / simple-prefix selector for log object keys.
Enum Values
target_object_key_format.partitioned_prefix.partition_date_source (PartitionDateSource)
| Value | DSL Identifier |
|---|---|
EventTime |
aws.s3.BucketLogging.TargetObjectKeyFormat.PartitionedPrefix.PartitionDateSource.event_time |
DeliveryTime |
aws.s3.BucketLogging.TargetObjectKeyFormat.PartitionedPrefix.PartitionDateSource.delivery_time |
Shorthand formats: event_time or PartitionDateSource.event_time
Struct Definitions
target_object_key_format
| Field | Type | Required | Description |
|---|---|---|---|
simple_prefix |
Struct(SimplePrefix) | No | |
partitioned_prefix |
Struct(PartitionedPrefix) | No |
target_object_key_format.partitioned_prefix
| Field | Type | Required | Description |
|---|---|---|---|
partition_date_source |
PartitionDateSource | No |
target_object_key_format.simple_prefix
| Field | Type | Required | Description |
|---|