-
Notifications
You must be signed in to change notification settings - Fork 2
/
iam_dsa_vault_admin.tf
71 lines (61 loc) · 1.64 KB
/
iam_dsa_vault_admin.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
resource "aws_iam_group" "vault_admin" {
name = "iam-group-vault-admin"
}
resource "aws_iam_group_membership" "vault_admin" {
name = "iam-group-membership-vault-admin"
users = [
aws_iam_user.vault_admin.name,
]
group = aws_iam_group.vault_admin.name
}
resource "aws_iam_policy" "vault_admin" {
name = "iam-policy-vault-admin"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iam:AttachUserPolicy",
"iam:CreateAccessKey",
"iam:CreateUser",
"iam:DeleteAccessKey",
"iam:DeleteUser",
"iam:DeleteUserPolicy",
"iam:DetachUserPolicy",
"iam:ListAccessKeys",
"iam:ListAttachedUserPolicies",
"iam:ListGroupsForUser",
"iam:ListUserPolicies",
"iam:PutUserPolicy",
"iam:AddUserToGroup",
"iam:RemoveUserFromGroup",
"iam:GetUser"
],
"Resource": "*"
}
]
}
EOF
}
resource "aws_iam_group_policy_attachment" "vault_admin" {
group = aws_iam_group.vault_admin.name
policy_arn = aws_iam_policy.vault_admin.arn
}
resource "aws_iam_user" "vault_admin" {
name = "iam-user-vault-admin"
}
// resource "aws_iam_access_key" "vault_admin" {
// user = aws_iam_user.vault_admin.name
// }
// resource "aws_ssm_parameter" "vault_admin_id" {
// name = "vault-admin-user-id"
// type = "SecureString"
// value = aws_iam_access_key.vault_admin.id
// }
// resource "aws_ssm_parameter" "vault_admin_key" {
// name = "vault-admin-user-key"
// type = "SecureString"
// value = aws_iam_access_key.vault_admin.secret
// }