Skip to content

Commit

Permalink
Allow command line exec to containers
Browse files Browse the repository at this point in the history
add extra policy to the task role
  • Loading branch information
keirbadger committed Oct 18, 2024
1 parent a64afdd commit 918e411
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,29 @@ resource "aws_iam_role_policy" "role_policy" {
policy = var.policy
}

resource "aws_iam_role_policy" "ecs_exec_policy" {
name = "ecs_exec_policy"
role = aws_iam_role.task_role.id

policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = [
"ssmmessages:CreateControlChannel",
"ssmmessages:CreateDataChannel",
"ssmmessages:OpenControlChannel",
"ssmmessages:OpenDataChannel",
"ecs:ExecuteCommand",
"ecs:DescribeTasks"
]
Effect = "Allow"
Resource = "*"
},
]
})
}

resource "aws_iam_role" "task_role" {
name_prefix = local.name_prefix
description = "Task role for ${var.family}"
Expand Down

0 comments on commit 918e411

Please sign in to comment.