Closed
Conversation
There was a problem hiding this comment.
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:GetSecretValuefor a small set of secret ARNs. - Attaches the custom Secrets Manager read policy to the
incubator_tf_planrole. - Introduces (intended) separate
incubator_tf_applyrole withAdministratorAccessfor 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" | ||
| } | ||
|
|
Member
Author
|
PR is superseded by Issue146 OIDC plan april |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #replace_this_text_with_the_issue_number
What changes did you make?
Why did you make the changes (we will use this info to test)?