-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautomation_role.tf
More file actions
32 lines (25 loc) · 798 Bytes
/
Copy pathautomation_role.tf
File metadata and controls
32 lines (25 loc) · 798 Bytes
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
data "aws_iam_policy_document" "instance-assume-role-policy" {
statement {
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = [
"ec2.amazonaws.com",
"ssm.amazonaws.com"
]
}
}
}
data "aws_iam_policy" "Amazonssm" {
arn = "arn:aws:iam::aws:policy/service-role/AmazonSSMAutomationRole"
}
resource "aws_iam_role" "AutomationServiceRole" {
name = "AutomationServiceRole"
path = "/system/"
assume_role_policy = data.aws_iam_policy_document.instance-assume-role-policy.json
}
resource "aws_iam_policy_attachment" "test-attach" {
name = "ExtraPolicyAttachment"
roles = ["${aws_iam_role.AutomationServiceRole.name}"]
policy_arn = data.aws_iam_policy.Amazonssm.arn
}