-
Notifications
You must be signed in to change notification settings - Fork 0
/
role-reader-developers.tf
50 lines (47 loc) · 1.25 KB
/
role-reader-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
45
46
47
48
49
resource "aws_iam_role" "developers-get-credentials" {
description = "role for all developers to get the read access for s3"
name = "${var.role-developers-get-credentials}"
force_detach_policies = true
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": [
"${var.accounts[0]}",
"${var.accounts[1]}"
]
},
"Action": "sts:AssumeRole",
"Condition": {}
}
]
}
EOF
}
resource "aws_iam_policy" "get-credentials-parameter-store" {
name = "${var.policy-get-credentials-parameter-store}"
description = "For getting the acces & secret keys from parameter store"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ssm:GetParameters",
"ssm:GetParameter"
],
"Resource": "${var.resource-ssm-credentials}"
}
]
}
EOF
}
resource "aws_iam_role_policy_attachment" "developers-get-credentials-attachment" {
role = "${aws_iam_role.developers-get-credentials.name}"
policy_arn = "${aws_iam_policy.get-credentials-parameter-store.arn}"
}