-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccess_web_s3.tf
More file actions
55 lines (50 loc) · 1.22 KB
/
access_web_s3.tf
File metadata and controls
55 lines (50 loc) · 1.22 KB
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
resource "aws_iam_role" "web_ag_role" {
#name = "ProjectWebAG"
name = "web_ag_role"
assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Sid = ""
Effect = "Allow"
Action = "sts:AssumeRole"
Principal = {
Service = "ec2.amazonaws.com"
}
},
{
Sid = ""
Effect = "Allow"
Action = "sts:AssumeRole"
Principal = {
Service = "autoscaling.amazonaws.com"
}
}
]
})
}
resource "aws_iam_policy" "web_ag_s3_policy" {
name = "AccessAGUploadS3"
description = "A policy to allow S3 access"
policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Effect = "Allow"
Action = [
"s3:PutObject",
"s3:PutObjectAcl",
"s3:GetObject"
#"s3:*"
]
Resource = "${aws_s3_bucket.bucket_patient_result_docs.arn}/*"
}]
})
}
resource "aws_iam_role_policy_attachment" "web_ag_s3_attachment" {
policy_arn = aws_iam_policy.web_ag_s3_policy.arn
role = aws_iam_role.web_ag_role.name
}
resource "aws_iam_instance_profile" "web_ag_instance_profile" {
name = "web_ag_instance_profile"
role = aws_iam_role.web_ag_role.name
}