-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathiam_snsgb_archive.tf
66 lines (59 loc) · 1.48 KB
/
iam_snsgb_archive.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
resource "aws_iam_policy" "dq_snsgb_archive_bucket_policy" {
name = "dq_snsgb_archive_bucket_policy"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:GetBucketLocation",
"s3:ListBucket",
"s3:ListBucketMultipartUploads",
"s3:ListMultipartUploadParts"
],
"Effect": "Allow",
"Resource": [
"${aws_s3_bucket.dq_snsgb_archive_bucket.arn}"
]
},
{
"Action": [
"s3:PutObject"
],
"Effect": "Allow",
"Resource": [
"${aws_s3_bucket.dq_snsgb_archive_bucket.arn}/*"
]
},
{
"Effect": "Allow",
"Action": [
"kms:Encrypt",
"kms:Decrypt",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:DescribeKey"
],
"Resource": [
"${aws_s3_bucket.dq_snsgb_archive_bucket.arn}"
]
}
]
}
EOF
}
resource "aws_iam_group_policy_attachment" "dq_snsgb_archive_bucket" {
group = aws_iam_group.dq_snsgb_archive_bucket.name
policy_arn = aws_iam_policy.dq_snsgb_archive_bucket_policy.arn
}
resource "aws_iam_user" "dq_snsgb_archive_bucket" {
name = "dq_snsgb_archive_bucket_user"
}
resource "aws_iam_group" "dq_snsgb_archive_bucket" {
name = "dq_snsgb_archive_bucket"
}
resource "aws_iam_group_membership" "dq_snsgb_archive_bucket" {
name = "dq_snsgb_archive_bucket"
users = [aws_iam_user.dq_snsgb_archive_bucket.name]
group = aws_iam_group.dq_snsgb_archive_bucket.name
}