-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiam-users.tf
60 lines (49 loc) · 1.7 KB
/
iam-users.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
resource "aws_iam_group" "admins" {
name = "admins"
}
data "aws_iam_policy" "DatabaseAdministrator" {
arn = "arn:aws:iam::aws:policy/job-function/DatabaseAdministrator"
}
data "aws_iam_policy" "SystemAdministrator" {
arn = "arn:aws:iam::aws:policy/job-function/SystemAdministrator"
}
data "aws_iam_policy" "NetworkAdministrator" {
arn = "arn:aws:iam::aws:policy/job-function/NetworkAdministrator"
}
data "aws_iam_policy" "IAMUserChangePassword" {
arn = "arn:aws:iam::aws:policy/IAMUserChangePassword"
}
resource "aws_iam_group_policy_attachment" "admins-1-policy-attach" {
group = "${aws_iam_group.admins.name}"
policy_arn = "${data.aws_iam_policy.DatabaseAdministrator.arn}"
}
resource "aws_iam_group_policy_attachment" "admins-2-policy-attach" {
group = "${aws_iam_group.admins.name}"
policy_arn = "${data.aws_iam_policy.SystemAdministrator.arn}"
}
resource "aws_iam_group_policy_attachment" "admins-3-policy-attach" {
group = "${aws_iam_group.admins.name}"
policy_arn = "${data.aws_iam_policy.NetworkAdministrator.arn}"
}
resource "aws_iam_group_policy_attachment" "admins-4-policy-attach" {
group = "${aws_iam_group.admins.name}"
policy_arn = "${data.aws_iam_policy.IAMUserChangePassword.arn}"
}
resource "aws_iam_user" "prnx-admin" {
name = "prnx-admin"
tags = {
Terraform = "true"
Environment = "prnx-perm"
}
}
resource "aws_iam_user_login_profile" "prnx-admin" {
user = "${aws_iam_user.prnx-admin.name}"
password_reset_required = true
pgp_key = "keybase:prnx-admin"
}
resource "aws_iam_user_group_membership" "prnx-admin" {
user = "${aws_iam_user.prnx-admin.name}"
groups = [
"${aws_iam_group.admins.name}",
]
}