-
Notifications
You must be signed in to change notification settings - Fork 2
/
iam_role_developers.tf
44 lines (39 loc) · 1.05 KB
/
iam_role_developers.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
# Allow IAM users from the main account to access this role
resource "aws_iam_role" "developers" {
name = "developers"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<id>:root"
},
"Action": "sts:AssumeRole",
"Condition": {}
}
]
}
EOF
}
# Dev permissions
resource "aws_iam_role_policy_attachment" "developer_dev_s3_full" {
count = var.env_name == "dev" ? 1 : 0
role = aws_iam_role.developers.name
policy_arn = aws_iam_policy.s3_full.arn
}
# Test permissions
resource "aws_iam_role_policy_attachment" "test_dev_s3_full" {
count = var.env_name == "test" ? 1 : 0
role = aws_iam_role.developers.name
policy_arn = aws_iam_policy.s3_full.arn
}
# UAT permissions
resource "aws_iam_role_policy_attachment" "uat_dev_s3_readonly" {
count = var.env_name == "uat" ? 1 : 0
role = aws_iam_role.developers.name
policy_arn = aws_iam_policy.s3_readonly.arn
}
# Prod permissions
# No special permissions