Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci-staging): refactor iam role #640

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading