-
-
Save christophetd/5f70f5af787450e62fe8a7165825e787 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_s3_bucket" "cloudtrail" { | |
bucket = local.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:::${local.bucket-name}" | |
}, | |
{ | |
"Sid": "AWSCloudTrailWrite", | |
"Effect": "Allow", | |
"Principal": { | |
"Service": "cloudtrail.amazonaws.com" | |
}, | |
"Action": "s3:PutObject", | |
"Resource": "arn:aws:s3:::${local.bucket-name}/*", | |
"Condition": { | |
"StringEquals": { | |
"s3:x-amz-acl": "bucket-owner-full-control" | |
} | |
} | |
} | |
] | |
} | |
POLICY | |
} | |
output "cloudtrail_trail_name" { | |
value = aws_cloudtrail.trail.name | |
} | |
output "display" { | |
value = format("CloudTrail trail %s ready", aws_cloudtrail.trail.arn) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment