forked from cmdlabs/cmd-tf-aws-guardduty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.tf
56 lines (52 loc) · 1.23 KB
/
data.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
51
52
53
54
55
56
# S3 Policy document --------------------------
data "aws_iam_policy_document" "s3_policy" {
version = "2012-10-17"
statement {
sid = "AWSGuarddutyBucketPermissionsCheck"
effect = "Allow"
actions = ["s3:GetBucketAcl"]
principals {
type = "Service"
identifiers = ["guardduty.amazonaws.com"]
}
resources = ["arn:aws:s3:::${var.bucket_name}"]
}
statement {
sid = "DenyNonSecureTransport"
effect = "Deny"
actions = ["s3:*"]
principals {
type = "*"
identifiers = ["*"]
}
resources = ["arn:aws:s3:::${var.bucket_name}/*"]
condition {
test = "Bool"
variable = "aws:SecureTransport"
values = ["false"]
}
}
statement {
sid = "AWSGuarddutyRead"
effect = "Allow"
actions = [
"s3:GetObject",
"s3:GetObjectVersion",
"s3:ListBucket",
"s3:ListBucketVersions"
]
principals {
type = "Service"
identifiers = ["guardduty.amazonaws.com"]
}
resources = [
"arn:aws:s3:::${var.bucket_name}/*",
"arn:aws:s3:::${var.bucket_name}"
]
condition {
test = "Bool"
variable = "aws:SecureTransport"
values = ["false"]
}
}
}