Skip to content

Commit

Permalink
feat: corrige infra
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroHPAlmeida committed Mar 30, 2024
1 parent b6be948 commit f0c51db
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions infra/gh_oidc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ resource "aws_iam_role" "gh_actions_role_oidc" {
data "aws_iam_policy_document" "data_policy" {
statement {
actions = [
"ecr:GetAuthorizationToken",
"ecr:BatchGetImage",
"ecr:BatchCheckLayerAvailability",
"ecr:CompleteLayerUpload",
Expand All @@ -48,13 +47,30 @@ data "aws_iam_policy_document" "data_policy" {
}
}


resource "aws_iam_policy" "ecr_pull_push" {
name = "gh_actions_ecr_pull_push"
policy = data.aws_iam_policy_document.data_policy.json
}

data "aws_iam_policy_document" "token" {
statement {
actions = ["ecr:GetAuthorizationToken"]
resources = ["*"]
effect = "Allow"
}
}

resource "aws_iam_policy" "token" {
name = "gh_actions_token"
policy = data.aws_iam_policy_document.token.json
}

resource "aws_iam_role_policy_attachment" "ecr_pull_push_attachment" {
role = aws_iam_role.gh_actions_role_oidc.name
policy_arn = aws_iam_policy.ecr_pull_push.arn
}

resource "aws_iam_role_policy_attachment" "token_attachment" {
role = aws_iam_role.gh_actions_role_oidc.name
policy_arn = aws_iam_policy.token.arn
}

0 comments on commit f0c51db

Please sign in to comment.