Skip to content

Commit a684453

Browse files
committed
[ELI-702] create and attach policy doc
1 parent b805b35 commit a684453

2 files changed

Lines changed: 70 additions & 0 deletions

File tree

infrastructure/stacks/iams-developer-roles/github_actions_policies.tf

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,69 @@ resource "aws_iam_policy" "cloudwatch_management" {
809809
tags = merge(local.tags, { Name = "cloudwatch-management" })
810810
}
811811

812+
resource "aws_iam_policy" "code_signing_management" {
813+
#checkov:skip=CKV_AWS_290: Actions require wildcard resource for Lambda code signing configs and Signer jobs
814+
#checkov:skip=CKV_AWS_235: Actions require wildcard resource for Lambda code signing configs and Signer jobs
815+
#checkov:skip=CKV_AWS_355: Actions require wildcard resource for Lambda code signing configs and Signer jobs
816+
name = "code-signing-management"
817+
description = "Allow GitHub Actions to manage Lambda code signing and start Signer jobs"
818+
path = "/service-policies/"
819+
820+
policy = jsonencode({
821+
Version = "2012-10-17",
822+
Statement = [
823+
{
824+
Sid = "LambdaCodeSigningConfigManagement",
825+
Effect = "Allow",
826+
Action = [
827+
"lambda:CreateCodeSigningConfig",
828+
"lambda:UpdateCodeSigningConfig",
829+
"lambda:DeleteCodeSigningConfig",
830+
"lambda:GetCodeSigningConfig",
831+
"lambda:ListCodeSigningConfigs",
832+
"lambda:GetFunctionCodeSigningConfig",
833+
"lambda:ListTags",
834+
"lambda:DeleteFunctionCodeSigningConfig",
835+
"lambda:PutFunctionCodeSigningConfig"
836+
],
837+
Resource = "*"
838+
},
839+
{
840+
Sid = "SignerProfileManagement"
841+
Effect = "Allow"
842+
Action = [
843+
"signer:GetSigningProfile",
844+
"signer:TagResource",
845+
"signer:UntagResource",
846+
"signer:ListTagsForResource"
847+
]
848+
Resource = local.lambda_signing_profile_arn
849+
},
850+
{
851+
Sid = "SignerProfileCreateAndList"
852+
Effect = "Allow"
853+
Action = [
854+
"signer:PutSigningProfile",
855+
"signer:ListSigningProfiles"
856+
]
857+
Resource = "*"
858+
},
859+
{
860+
Sid = "SignerJobUsage",
861+
Effect = "Allow",
862+
Action = [
863+
"signer:StartSigningJob",
864+
"signer:DescribeSigningJob",
865+
"signer:ListSigningJobs"
866+
],
867+
Resource = "*"
868+
},
869+
]
870+
})
871+
872+
tags = merge(local.tags, { Name = "code-signing-management" })
873+
}
874+
812875
# Attach the policies to the role
813876
resource "aws_iam_role_policy_attachment" "terraform_state" {
814877
role = aws_iam_role.github_actions.name
@@ -859,3 +922,8 @@ resource "aws_iam_role_policy_attachment" "kinesis_management_attach" {
859922
role = aws_iam_role.github_actions.name
860923
policy_arn = aws_iam_policy.kinesis_management.arn
861924
}
925+
926+
resource "aws_iam_role_policy_attachment" "code_signing_management" {
927+
role = aws_iam_role.github_actions.name
928+
policy_arn = aws_iam_policy.code_signing_management.arn
929+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
locals {
22
stack_name = "iams-developer-roles"
3+
lambda_signing_profile_name = "${terraform.workspace == "default" ? "" : "${terraform.workspace}"}EligibilityApiLambdaSigningProfile"
4+
lambda_signing_profile_arn = "arn:aws:signer:${var.default_aws_region}:${data.aws_caller_identity.current.account_id}:/signing-profiles/${local.lambda_signing_profile_name}"
35
}

0 commit comments

Comments
 (0)