Skip to content

Commit 0fff40e

Browse files
Mohitsharma44claude
andcommitted
fix(ci): remove hardcoded AWS profile from backend and provider
The S3 backend had profile=muon which doesn't exist in CI runners. Removed profile from backend block (uses AWS_PROFILE env var locally, OIDC env vars in CI). Made provider profile conditional — empty string falls back to default credential chain. Added TF_VAR_aws_profile="" to CI workflow env. Also removed OIDC debug step and fixed org name casing in variables. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fb79fe7 commit 0fff40e

3 files changed

Lines changed: 7 additions & 9 deletions

File tree

.github/workflows/terraform.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,16 @@ concurrency:
1919
group: terraform-${{ github.ref }}
2020
cancel-in-progress: false
2121

22+
env:
23+
TF_VAR_aws_profile: ""
24+
2225
jobs:
2326
plan:
2427
name: Terraform Plan
2528
runs-on: ubuntu-latest
2629
if: github.event_name == 'pull_request'
2730

2831
steps:
29-
- name: Debug OIDC Token
30-
run: |
31-
IDTOKEN=$(curl -sS -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=sts.amazonaws.com" | jq -r '.value')
32-
echo "$IDTOKEN" | cut -d. -f2 | base64 -d 2>/dev/null | jq '{sub, aud, iss, ref, repository}' || true
33-
3432
- name: Checkout repository
3533
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3634

infra/providers.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ terraform {
1414
region = "us-east-1"
1515
dynamodb_table = "cuspuo-terraform-lock"
1616
encrypt = true
17-
profile = "muon"
17+
# No profile here — uses AWS_PROFILE env var locally, OIDC env vars in CI
1818
}
1919
}
2020

2121
provider "aws" {
2222
region = "us-east-1"
23-
profile = var.aws_profile
23+
profile = var.aws_profile != "" ? var.aws_profile : null
2424

2525
default_tags {
2626
tags = {

infra/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ variable "state_lock_table_name" {
2323
}
2424

2525
variable "github_org" {
26-
description = "GitHub organization name (lowercase, as used in OIDC sub claim)"
26+
description = "GitHub organization name (case-sensitive, must match OIDC sub claim)"
2727
type = string
28-
default = "cuspuo"
28+
default = "CUSPUO"
2929
}
3030

3131
variable "github_repo" {

0 commit comments

Comments
 (0)