Skip to content

Commit

Permalink
chore(ci-staging): refactor iam role (#640)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoIeni authored Dec 4, 2024
1 parent cdbf5b2 commit 20bcecc
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions terragrunt/modules/ci-runners/iam.tf
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
// Grant CodeBuild project IAM role access to use the connection, as documented in
// https://docs.aws.amazon.com/codebuild/latest/userguide/connections-github-app.html#connections-github-role-access
resource "aws_iam_role" "codebuild_role" {
name = "codebuild-github-runner-role"
data "aws_iam_policy_document" "codebuild_policy_doc" {
statement {
effect = "Allow"

assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Principal = {
Service = "codebuild.amazonaws.com"
}
Action = "sts:AssumeRole"
}
]
})
principals {
type = "Service"
identifiers = ["codebuild.amazonaws.com"]
}

actions = ["sts:AssumeRole"]
}
}

resource "aws_iam_role" "codebuild_role" {
name = "codebuild-github-runner-role"
assume_role_policy = data.aws_iam_policy_document.codebuild_policy_doc.json
}

# Add inline or managed policy for the permissions
resource "aws_iam_role_policy" "codebuild_policy" {
name = "codebuild-github-runner-policy"
role = aws_iam_role.codebuild_role.id
Expand Down

0 comments on commit 20bcecc

Please sign in to comment.