-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdata.tf
74 lines (57 loc) · 1.33 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
data "aws_caller_identity" "this" {}
data "aws_region" "this" {}
data "aws_partition" "current" {}
data "aws_iam_policy_document" "bucket" {
count = var.enable_vpc_flow_logs ? 1 : 0
statement {
sid = "AWSLogDeliveryWrite"
principals {
type = "Service"
identifiers = ["delivery.logs.amazonaws.com"]
}
actions = [
"s3:PutObject"
]
resources = [
"${local.arn_format}:s3:::${local.vpc_flow_logs_bucket}/*"
]
condition {
test = "StringEquals"
variable = "s3:x-amz-acl"
values = [
"bucket-owner-full-control"
]
}
}
statement {
sid = "AWSLogDeliveryAclCheck"
principals {
type = "Service"
identifiers = ["delivery.logs.amazonaws.com"]
}
actions = [
"s3:GetBucketAcl"
]
resources = [
"${local.arn_format}:s3:::${local.vpc_flow_logs_bucket}"
]
}
statement {
sid = "ForceSSLOnlyAccess"
effect = "Deny"
actions = ["s3:*"]
resources = [
"${local.arn_format}:s3:::${local.vpc_flow_logs_bucket}/*",
"${local.arn_format}:s3:::${local.vpc_flow_logs_bucket}"
]
principals {
identifiers = ["*"]
type = "*"
}
condition {
test = "Bool"
values = ["false"]
variable = "aws:SecureTransport"
}
}
}