-
Notifications
You must be signed in to change notification settings - Fork 2
/
iam.tf
37 lines (34 loc) · 1.19 KB
/
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
// Role Devops allows to be assumed by users from the account 841591717599 (vpcdeployments) logged with active MFA
resource "aws_iam_role" "etleap-role-devops" {
count = var.allow_iam_devops_role ? 1 : 0
tags = local.default_tags
name = "Etleap-${var.deployment_id}-Devops-Role"
description = "Role for Etleap Devops users"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::841591717599:root"
},
"Action": "sts:AssumeRole",
"Condition": {
"Bool": {"aws:MultiFactorAuthPresent": "true"},
"StringLike": { "sts:RoleSessionName": "$${aws:username}" }
}
}
]
}
EOF
}
output "iam_role_devops_arn" {
description = "IAM Devops Role ARN to be used by Etleap Devops users"
value = var.allow_iam_devops_role ? aws_iam_role.etleap-role-devops[0].arn : null
}
resource "aws_iam_role_policy_attachment" "devops-admin-access" {
count = var.allow_iam_devops_role ? 1 : 0
role = aws_iam_role.etleap-role-devops[0].name
policy_arn = "arn:aws:iam::aws:policy/AdministratorAccess"
}