-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathiam.tf
39 lines (37 loc) · 1.02 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
resource "aws_iam_role" "ecs_autoscale_role" {
name = "${var.project}-${var.environment}-ecs-autoscale-role"
assume_role_policy = "${file("${path.module}/templates/autoscale-assume-role.json")}"
}
resource "aws_iam_policy" "ecs_autoscale_policy" {
name = "${var.project}-${var.environment}-ecs-autoscale-policy"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ecs:DescribeServices",
"ecs:UpdateService"
],
"Resource": [
"*"
]
},
{
"Effect": "Allow",
"Action": [
"cloudwatch:DescribeAlarms"
],
"Resource": [
"*"
]
}
]
}
EOF
}
resource "aws_iam_role_policy_attachment" "ecs-autoscale-role-attach" {
role = "${aws_iam_role.ecs_autoscale_role.name}"
policy_arn = "${aws_iam_policy.ecs_autoscale_policy.arn}"
}