forked from tonyprawiro/aws-msad-terraform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiam_roles.tf
65 lines (61 loc) · 1.6 KB
/
iam_roles.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
#
# Instance profile for bastion host
#
resource "aws_iam_instance_profile" "instance_profile_adwriter" {
name = "INSTANCE_PROFILE_ADWRITER"
role = "${aws_iam_role.iam_role_adwriter.name}"
}
resource "aws_iam_role" "iam_role_adwriter" {
name = "IAM_ROLE_ADWRITER"
path = "/"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF
}
resource "aws_iam_role_policy" "policy_allow_all_ssm" {
name = "IAM_POLICY_ALLOW_ALL_SSM"
role = "${aws_iam_role.iam_role_adwriter.id}"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAccessToSSM",
"Effect": "Allow",
"Action": [
"ssm:DescribeAssociation",
"ssm:ListAssociations",
"ssm:GetDocument",
"ssm:ListInstanceAssociations",
"ssm:UpdateAssociationStatus",
"ssm:UpdateInstanceInformation",
"ec2messages:AcknowledgeMessage",
"ec2messages:DeleteMessage",
"ec2messages:FailMessage",
"ec2messages:GetEndpoint",
"ec2messages:GetMessages",
"ec2messages:SendReply",
"ds:CreateComputer",
"ds:DescribeDirectories",
"ec2:DescribeInstanceStatus"
],
"Resource": [
"*"
]
}
]
}
EOF
}