Skip to content

Commit d127267

Browse files
authored
Add needed ecs permissions for CICD user (#68)
After running the updated [ECS workflow](https://github.com/QED-it/zebra/pull/67/files) changing the docker image in the task definition we saw that extra permissions are needed for the CICD user. This PR adds the minimal needed permissions.
2 parents f4989c0 + e1ad4fc commit d127267

File tree

1 file changed

+14
-0
lines changed
  • testnet-single-node-deploy/infra/terraform-aws-modules/cicd-user

1 file changed

+14
-0
lines changed

testnet-single-node-deploy/infra/terraform-aws-modules/cicd-user/main.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ resource "aws_iam_policy" "ecr_ecs_policy" {
3232
"ecs:ListServices",
3333
"ecs:ListTasks",
3434
"ecs:DescribeTasks",
35+
"ecs:DescribeTaskDefinition",
36+
"ecs:RegisterTaskDefinition",
3537
"ecs:RunTask",
3638
"ecs:StopTask",
3739
"ecs:StartTask"
@@ -45,6 +47,18 @@ resource "aws_iam_policy" "ecr_ecs_policy" {
4547
"lambda:*"
4648
]
4749
Resource = "arn:aws:lambda:${var.aws_region}:${var.aws_account_id}:function:watch-zebra-logs"
50+
},
51+
{
52+
# The CICD user needs the iam:PassRole permission to pass the ECS execution role when registering task definitions.
53+
Sid = "AllowPassRole"
54+
Effect = "Allow"
55+
Action = [
56+
"iam:PassRole"
57+
]
58+
Resource = [
59+
"arn:aws:iam::${var.aws_account_id}:role/${var.env}-zebra-ecs_execution_role",
60+
"arn:aws:iam::${var.aws_account_id}:role/${var.env}-zebra-ecs_task_role"
61+
]
4862
}
4963
]
5064
})

0 commit comments

Comments
 (0)