Skip to content

Commit a46dcd7

Browse files
authored
fix(terraform): FTRS-31811 FTRS-3181 Add github runner permissions fo… (#942)
1 parent 101ec12 commit a46dcd7

File tree

1 file changed

+29
-11
lines changed
  • infrastructure/stacks/account_wide

1 file changed

+29
-11
lines changed

infrastructure/stacks/account_wide/kms.tf

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -282,24 +282,42 @@ module "scheduler_encryption_key" {
282282
description = "Encryption key for EventBridge scheduler in ${var.environment} environment"
283283
additional_policy_statements = [
284284
{
285-
"Sid" : "AllowEventBridgeSchedulerToUseKMS",
286-
"Effect" : "Allow",
287-
"Principal" : {
288-
"Service" : "scheduler.amazonaws.com"
289-
},
290-
"Action" : [
285+
Sid = "AllowEventBridgeSchedulerToUseKMS"
286+
Effect = "Allow"
287+
Principal = {
288+
Service = ["scheduler.amazonaws.com"]
289+
}
290+
Action = [
291291
"kms:CreateGrant",
292292
"kms:RetireGrant",
293293
"kms:Decrypt",
294294
"kms:GenerateDataKey*",
295295
"kms:DescribeKey"
296-
],
297-
"Resource" : "*",
298-
"Condition" : {
299-
"StringEquals" : {
300-
"aws:SourceAccount" : data.aws_caller_identity.current.account_id
296+
]
297+
Resource = "*"
298+
Condition = {
299+
StringEquals = {
300+
"aws:SourceAccount" = data.aws_caller_identity.current.account_id
301301
}
302302
}
303+
},
304+
{
305+
Sid = "AllowGitHubRunnerAccess"
306+
Effect = "Allow"
307+
Principal = {
308+
AWS = [
309+
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${local.account_prefix}-${var.app_github_runner_role_name}",
310+
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${local.account_prefix}-${var.account_github_runner_role_name}"
311+
]
312+
}
313+
Action = [
314+
"kms:Decrypt",
315+
"kms:Encrypt",
316+
"kms:GenerateDataKey*",
317+
"kms:DescribeKey"
318+
]
319+
Resource = "*"
320+
Condition = {}
303321
}
304322
]
305323
}

0 commit comments

Comments
 (0)