-
Notifications
You must be signed in to change notification settings - Fork 0
/
s3.tf
47 lines (46 loc) · 1.53 KB
/
s3.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
resource "aws_s3_bucket" "status_logs" {
bucket = "cachet-alb-logs-${data.aws_caller_identity.current.account_id}"
acl = "log-delivery-write"
force_destroy = true
region = data.aws_region.current.name
policy = <<EOF
{
"Version": "2012-10-17",
"Id": "AWSConsole-AccessLogs-Policy-1564760075096",
"Statement": [
{
"Sid": "AWSConsoleStmt-1564760075096",
"Effect": "Allow",
"Principal": {
"AWS": "${local.elb_arn}"
},
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::cachet-alb-logs-${data.aws_caller_identity.current.account_id}/AWSLogs/${data.aws_caller_identity.current.account_id}/*"
},
{
"Sid": "AWSLogDeliveryWrite",
"Effect": "Allow",
"Principal": {
"Service": "delivery.logs.amazonaws.com"
},
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::cachet-alb-logs-${data.aws_caller_identity.current.account_id}/AWSLogs/${data.aws_caller_identity.current.account_id}/*",
"Condition": {
"StringEquals": {
"s3:x-amz-acl": "bucket-owner-full-control"
}
}
},
{
"Sid": "AWSLogDeliveryAclCheck",
"Effect": "Allow",
"Principal": {
"Service": "delivery.logs.amazonaws.com"
},
"Action": "s3:GetBucketAcl",
"Resource": "arn:aws:s3:::cachet-alb-logs-${data.aws_caller_identity.current.account_id}"
}
]
}
EOF
}