You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
892 B
24 lines
892 B
resource "aws_iam_role" "my_api_task_execution_role" { |
|
name = "my-api-task-execution-role" |
|
assume_role_policy = data.aws_iam_policy_document.ecs_task_assume_role.json |
|
} |
|
data "aws_iam_policy_document" "ecs_task_assume_role" { |
|
statement { |
|
actions = ["sts:AssumeRole"] |
|
principals { |
|
type = "Service" |
|
identifiers = ["ecs-tasks.amazonaws.com"] |
|
} |
|
} |
|
} |
|
# Normally we'd prefer not to hardcode an ARN in our Terraform, but since this is |
|
# an AWS-managed policy, it's okay. |
|
data "aws_iam_policy" "ecs_task_execution_role" { |
|
arn = "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy" |
|
} |
|
# Attach the above policy to the execution role. |
|
resource "aws_iam_role_policy_attachment" "ecs_task_execution_role" { |
|
role = aws_iam_role.my_api_task_execution_role.name |
|
policy_arn = data.aws_iam_policy.ecs_task_execution_role.arn |
|
} |
|
|
|
|