-
Notifications
You must be signed in to change notification settings - Fork 0
/
_data.tf
54 lines (47 loc) · 1.09 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
data "aws_iam_policy_document" "allow_public_access" {
count = var.create && var.bucket_type == "public" ? 1 : 0
statement {
sid = "AllowGetPublic"
actions = [
"s3:GetObject",
]
resources = [
"${aws_s3_bucket.bucket[0].arn}",
"${aws_s3_bucket.bucket[0].arn}/*",
]
principals {
type = "AWS"
identifiers = ["*"]
}
}
}
data "aws_iam_policy_document" "allow_read_write" {
count = var.create && (var.create_iam_user || length(var.create_iam_eks_role) > 0) ? 1 : 0
statement {
sid = "AllowListBucket"
actions = [
"s3:ListBucket",
"s3:ListBucketMultipartUploads"
]
resources = [
"${aws_s3_bucket.bucket[0].arn}"
]
}
statement {
sid = "AllowRWBucket"
actions = [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject",
"s3:ListBucket",
"s3:ListObjects",
"s3:PutObjectAcl",
"s3:AbortMultipartUpload",
"s3:ListMultipartUploadParts",
]
resources = [
"${aws_s3_bucket.bucket[0].arn}/*"
]
}
}
data "aws_canonical_user_id" "current" {}