-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiam.tf
40 lines (35 loc) · 906 Bytes
/
iam.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
resource "aws_iam_user" "iam_user" {
name = "${var.SiteName}-Bucket"
path = "/"
tags = {
description = "Wordpress Website access S3"
}
}
resource "aws_iam_access_key" "iam_user" {
user = "${aws_iam_user.iam_user.name}"
}
resource "aws_iam_user_policy" "iam_user" {
name = "${var.SiteName}"
user = "${aws_iam_user.iam_user.name}"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:CreateBucket",
"s3:DeleteObject",
"s3:Put*",
"s3:Get*",
"s3:List*"
],
"Resource": [
"${aws_s3_bucket.bucket_s3.arn}",
"${aws_s3_bucket.bucket_s3.arn}/*"
]
}
]
}
EOF
}