forked from carlossura/terraform-aws-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiam.tf
27 lines (22 loc) · 748 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
# iam.tf | IAM Role Policies
resource "aws_iam_role" "ecsTaskExecutionRole" {
name = "${var.app_name}-execution-task-role"
assume_role_policy = data.aws_iam_policy_document.assume_role_policy.json
tags = {
Name = "${var.app_name}-iam-role"
Environment = var.app_environment
}
}
data "aws_iam_policy_document" "assume_role_policy" {
statement {
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["ecs-tasks.amazonaws.com"]
}
}
}
resource "aws_iam_role_policy_attachment" "ecsTaskExecutionRole_policy" {
role = aws_iam_role.ecsTaskExecutionRole.name
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role"
}