-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathiam.tf
34 lines (30 loc) · 792 Bytes
/
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
data "aws_iam_policy_document" "cloudwatchAccess" {
statement {
sid = "1"
actions = [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
]
resources = ["arn:aws:logs:*:*:*"]
}
statement {
sid = "2"
actions = [
"ecs:DescribeServices",
"ecs:UpdateService",
"autoscaling:DescribeAutoScalingGroups"
]
resources = ["*"]
}
}
resource "aws_iam_policy" "cloudwatchAccess" {
name = "${var.lambda_name}-policy"
path = "/"
policy = "${data.aws_iam_policy_document.cloudwatchAccess.json}"
}
resource "aws_iam_policy_attachment" "attachment" {
name = "ecs-attachment"
roles = ["${aws_iam_role.lambda_shuffler_role.name}"]
policy_arn = "${aws_iam_policy.cloudwatchAccess.arn}"
}