Skip to content

Commit b408996

Browse files
Fix OIDC trust policy + add permissions boundary for password-set role
Two issues blocking apply: 1. ci-infra OIDC trust only matched ref-based sub claims, but the apply job uses `environment: production` which sends environment-based claims. Added both formats to the trust condition. 2. password-set IAM role was missing permissions_boundary, which the developer boundary requires for all new roles created via CI. Also reverts v5 pin from #57 since that wasn't the root cause.
1 parent 1eb3ac1 commit b408996

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

.github/workflows/platform-ci.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ jobs:
152152
terraform_version: "1.7"
153153
terraform_wrapper: false
154154

155-
# Pinned to v5 — v6 breaks OIDC AssumeRoleWithWebIdentity for this role
156-
- uses: aws-actions/configure-aws-credentials@v5
155+
- uses: aws-actions/configure-aws-credentials@v6
157156
with:
158157
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/javabin-ci-infra
159158
aws-region: ${{ env.AWS_REGION }}
@@ -201,8 +200,7 @@ jobs:
201200
terraform_version: "1.7"
202201
terraform_wrapper: false
203202

204-
# Pinned to v5 — v6 breaks OIDC AssumeRoleWithWebIdentity for this role
205-
- uses: aws-actions/configure-aws-credentials@v5
203+
- uses: aws-actions/configure-aws-credentials@v6
206204
with:
207205
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/javabin-ci-infra
208206
aws-region: ${{ env.AWS_REGION }}

terraform/platform/iam/main.tf

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,13 @@ resource "aws_iam_role" "ci_infra" {
162162
"token.actions.githubusercontent.com:aud" = "sts.amazonaws.com"
163163
}
164164
StringLike = {
165-
# Main branch ONLY — apply never runs on PRs
166-
"token.actions.githubusercontent.com:sub" = "repo:${var.github_org}/platform:ref:refs/heads/main"
165+
# Main branch OR production environment — the apply job uses
166+
# `environment: production`, which changes the OIDC sub claim
167+
# from ref-based to environment-based.
168+
"token.actions.githubusercontent.com:sub" = [
169+
"repo:${var.github_org}/platform:ref:refs/heads/main",
170+
"repo:${var.github_org}/platform:environment:production",
171+
]
167172
}
168173
}
169174
}

terraform/platform/lambdas/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,8 @@ resource "aws_iam_role_policy_attachment" "team_provisioner_logs" {
533533

534534
# --- password-set role ---
535535
resource "aws_iam_role" "password_set" {
536-
name = "${var.project}-password-set"
536+
name = "${var.project}-password-set"
537+
permissions_boundary = "arn:aws:iam::${var.aws_account_id}:policy/${var.project}-developer-boundary"
537538

538539
assume_role_policy = jsonencode({
539540
Version = "2012-10-17"

0 commit comments

Comments
 (0)