Skip to content

Commit 4c08f9f

Browse files
authored
chor: Only allow termination of runner instances (#201)
1 parent d168a94 commit 4c08f9f

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

modules/runners/policies/lambda-scale-down.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,21 @@
55
"Effect": "Allow",
66
"Action": [
77
"ec2:DescribeInstances*",
8-
"ec2:DescribeTags",
9-
"ec2:DeleteTags",
10-
"ec2:TerminateInstances"
8+
"ec2:DescribeTags"
119
],
1210
"Resource": ["*"]
11+
},
12+
{
13+
"Effect": "Allow",
14+
"Action": [
15+
"ec2:TerminateInstances"
16+
],
17+
"Resource": ["*"],
18+
"Condition": {
19+
"StringEquals": {
20+
"ec2:ResourceTag/Application": "github-action-runner"
21+
}
22+
}
1323
}
1424
]
1525
}

modules/runners/policies/lambda-scale-up.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,22 @@
66
"Action": [
77
"ec2:DescribeInstances",
88
"ec2:DescribeTags",
9-
"ec2:CreateTags",
109
"ec2:RunInstances"
1110
],
1211
"Resource": ["*"]
1312
},
13+
{
14+
"Effect": "Allow",
15+
"Action": [
16+
"ec2:CreateTags"
17+
],
18+
"Resource": ["*"],
19+
"Condition": {
20+
"StringEquals": {
21+
"ec2:CreateAction" : "RunInstances"
22+
}
23+
}
24+
},
1425
{
1526
"Effect": "Allow",
1627
"Action": "iam:PassRole",

0 commit comments

Comments
 (0)