-
Notifications
You must be signed in to change notification settings - Fork 0
/
eks-cloudtrail.tf
50 lines (44 loc) · 1.35 KB
/
eks-cloudtrail.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
48
49
50
resource "aws_cloudtrail" "demo-eks-cluster-cloudtrail" {
name = "${var.trail_name}"
s3_bucket_name = "${aws_s3_bucket.demo-eks-cloudtrail-bucket.id}"
include_global_service_events = "${var.include_global_service_events}"
is_multi_region_trail = "${var.is_multi_region_trail}"
#sns_topic_name = "${var.sns_topic_name}"
tags {
Name = "${var.trail_name}"
}
}
resource "aws_s3_bucket" "demo-eks-cloudtrail-bucket" {
bucket = "${var.s3_bucket_name}"
force_destroy = true
policy = <<POLICY
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AWSCloudTrailAclCheck",
"Effect": "Allow",
"Principal": {
"Service": "cloudtrail.amazonaws.com"
},
"Action": "s3:GetBucketAcl",
"Resource": "arn:aws:s3:::demo-eks-cloudtrail-bucket"
},
{
"Sid": "AWSCloudTrailWrite",
"Effect": "Allow",
"Principal": {
"Service": "cloudtrail.amazonaws.com"
},
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::demo-eks-cloudtrail-bucket/*",
"Condition": {
"StringEquals": {
"s3:x-amz-acl": "bucket-owner-full-control"
}
}
}
]
}
POLICY
}