-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiam.tf
More file actions
29 lines (22 loc) · 722 Bytes
/
Copy pathiam.tf
File metadata and controls
29 lines (22 loc) · 722 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
resource "aws_iam_role" "ecs" {
name = "ecs-${local.namespace}"
path = "/"
assume_role_policy = "${data.template_file.trust-ec2-sts.rendered}"
tags = {
Name = "ecs-${local.namespace}"
namespace = "${local.namespace}"
}
}
resource "aws_iam_instance_profile" "ecs" {
name = "ecs-${local.namespace}"
role = "${aws_iam_role.ecs.name}"
depends_on = [aws_iam_role.ecs]
}
resource "aws_iam_role_policy_attachment" "ecs" {
role = "${aws_iam_role.ecs.name}"
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role"
depends_on = [aws_iam_role.ecs]
}
data "template_file" "trust-ec2-sts" {
template = "${file("${path.module}/templates/iam_ec2_sts.tmpl")}"
}