File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,44 @@ resource "aws_iam_role_policy" "github_runner_execution_role_policy" {
4848 })
4949}
5050
51+ data "aws_iam_policy_document" "github_runner_task_assume_role" {
52+ statement {
53+ effect = " Allow"
54+
55+ principals {
56+ type = " Service"
57+ identifiers = [" ecs.amazonaws.com" , " ecs-tasks.amazonaws.com" ]
58+ }
59+
60+ actions = [" sts:AssumeRole" ]
61+ }
62+ }
63+
64+
65+ resource "aws_iam_role" "github_runner_task_role" {
66+ name = " github_runner_task_role"
67+ assume_role_policy = data. aws_iam_policy_document . github_runner_task_assume_role . json
68+ }
69+
70+ resource "aws_iam_role_policy" "github_runner_task_role_policy" {
71+ name = " github_runner_task_role_policy"
72+ role = aws_iam_role. github_runner_task_role . id
73+
74+ policy = jsonencode ({
75+ Version = " 2012-10-17"
76+ Statement = [
77+ {
78+ Effect = " Allow"
79+ Action = [
80+ " ecs:ExecuteCommand" ,
81+ " ssmmessages:*"
82+ ]
83+ Resource = " *"
84+ }
85+ ]
86+ })
87+ }
88+
5189
5290resource "aws_cloudwatch_log_group" "github_runner" {
5391 name = " /github-runner/"
@@ -61,6 +99,7 @@ resource "aws_ecs_task_definition" "github_runner" {
6199 cpu = 1024
62100 memory = 2048
63101 execution_role_arn = aws_iam_role. github_runner_execution_role . arn
102+ task_role_arn = aws_iam_role. github_runner_task_role . arn
64103
65104 container_definitions = jsonencode ([
66105 {
You can’t perform that action at this time.
0 commit comments