Skip to content

Issue146 separate plan apply roles#152

Closed
Benettonkkb wants to merge 8 commits intomainfrom
issue146-separate-plan-apply-roles
Closed

Issue146 separate plan apply roles#152
Benettonkkb wants to merge 8 commits intomainfrom
issue146-separate-plan-apply-roles

Conversation

@Benettonkkb
Copy link
Copy Markdown
Member

Fixes #replace_this_text_with_the_issue_number

What changes did you make?

  • Added explicit Secrets Manager permissions to tf_plan via custom roles

Why did you make the changes (we will use this info to test)?

  • Did it with custom roles as opposed to explicitly in the code because I believe it's a better and more smooth way to write it. Can edit previous edits made in the more robust way, if recommended.

Copilot AI review requested due to automatic review settings April 15, 2026 20:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to separate Terraform “plan” vs “apply” IAM roles for the incubator GitHub Actions OIDC setup, and to grant the plan role explicit read access to specific AWS Secrets Manager secrets needed during planning.

Changes:

  • Adds a customer-managed IAM policy allowing secretsmanager:GetSecretValue for a small set of secret ARNs.
  • Attaches the custom Secrets Manager read policy to the incubator_tf_plan role.
  • Introduces (intended) separate incubator_tf_apply role with AdministratorAccess for main-branch applies.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
terraform/aws-gha-oidc-providers.tf Adds/attaches plan/apply role policies (currently introduces duplicate Terraform resources).
terraform/aws-custom-policies/incubator-tf-plan-secrets-read-policy.json New custom IAM policy allowing read access to specific Secrets Manager secrets.
terraform/aws-custom-policies.tf Registers the new custom policy in the aws_custom_policies module.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +52 to +78
resource "aws_iam_role" "incubator_tf_apply" {
name = "incubator-tf-apply"

assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Action = "sts:AssumeRoleWithWebIdentity"
Principal = {
Federated = module.iam_oidc_gha_incubator.provider_arn
}
Condition = {
StringEquals = {
"token.actions.githubusercontent.com:aud" = "sts.amazonaws.com"
}
StringLike = {
"token.actions.githubusercontent.com:sub" = [
"repo:hackforla/incubator:ref:refs/heads/main"
]
}
}
}
]
})
}

Comment on lines +79 to +82
resource "aws_iam_role_policy_attachment" "incubator_tf_apply_admin" {
role = aws_iam_role.incubator_tf_apply.name
policy_arn = "arn:aws:iam::aws:policy/AdministratorAccess"
}
Comment on lines +42 to +44
resource "aws_iam_role_policy_attachment" "incubator_tf_plan_readonly" {
role = aws_iam_role.incubator_tf_plan.name
policy_arn = "arn:aws:iam::aws:policy/ReadOnlyAccess"
Comment on lines +42 to +46
resource "aws_iam_role_policy_attachment" "incubator_tf_plan_readonly" {
role = aws_iam_role.incubator_tf_plan.name
policy_arn = "arn:aws:iam::aws:policy/ReadOnlyAccess"
}

@Benettonkkb
Copy link
Copy Markdown
Member Author

PR is superseded by Issue146 OIDC plan april

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants