-
Notifications
You must be signed in to change notification settings - Fork 0
/
iam.tf
64 lines (48 loc) · 1.45 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
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
# HR
resource "aws_iam_group" "HR" {
name = "HR"
}
resource "aws_iam_policy_attachment" "s3-readonly-attachment" {
name = "s3-readonly-attachment"
groups = ["${aws_iam_group.HR.name}"]
policy_arn = "arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess"
}
resource "aws_iam_user" "john" {
name = "john"
}
resource "aws_iam_policy_attachment" "glacier-readonly-attachment" {
name = "glacier-readonly-attachment"
users = ["${aws_iam_user.john.name}"]
policy_arn = "arn:aws:iam::aws:policy/AmazonGlacierReadOnlyAccess"
}
resource "aws_iam_policy_attachment" "IAMUserChangePassword-attachment" {
name = "IAMUserChangePassword-attachment"
users = ["${aws_iam_user.john.name}"]
policy_arn = "arn:aws:iam::aws:policy/IAMUserChangePassword"
}
resource "aws_iam_group_membership" "HR-membership" {
name = "HR-membership"
users = [
"${aws_iam_user.john.name}"
]
group = "${aws_iam_group.HR.name}"
}
# System-admin
resource "aws_iam_group" "System-Admin" {
name = "System-Admin"
}
resource "aws_iam_policy_attachment" "admin-attachment" {
name = "admin-attachment"
groups = ["${aws_iam_group.System-Admin.name}"]
policy_arn = "arn:aws:iam::aws:policy/AdministratorAccess"
}
resource "aws_iam_user" "ryan" {
name = "ryan"
}
resource "aws_iam_group_membership" "Admin-membership" {
name = "Admin-membership"
users = [
"${aws_iam_user.ryan.name}"
]
group = "${aws_iam_group.System-Admin.name}"
}