generated from geekcell/terraform-aws-module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.tf
50 lines (42 loc) · 1.18 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
data "aws_iam_policy_document" "main" {
dynamic "statement" {
for_each = [true]
content {
sid = "AccessRules"
resources = [aws_efs_file_system.main.arn]
effect = "Allow"
principals {
type = "AWS"
identifiers = var.aws_iam_principals
}
actions = compact([
!var.prevent_root_access_default ? "elasticfilesystem:ClientRootAccess" : null,
!var.enforce_read_only_default ? "elasticfilesystem:ClientWrite" : null,
!var.prevent_anonymous_access ? "elasticfilesystem:ClientMount" : null,
])
condition {
test = "Bool"
variable = "elasticfilesystem:AccessedViaMountTarget"
values = ["true"]
}
}
}
dynamic "statement" {
for_each = var.enforce_transit_encryption ? [true] : []
content {
sid = "EnforceInTransitEncryption"
resources = [aws_efs_file_system.main.arn]
effect = "Deny"
actions = ["*"]
principals {
type = "AWS"
identifiers = ["*"]
}
condition {
test = "Bool"
variable = "aws:SecureTransport"
values = ["false"]
}
}
}
}