Eve library

GitHub OIDC — CI IAM roles

Other

Revision 1

On this page

Account-global Terraform root that provisions the least-privilege IAM roles GitHub Actions assumes via OIDC. Currently it manages the model-sync role (read-only S3 → RunPod), replacing the long-lived static AWS keys the model-sync.yml workflow used to store and embed into the RunPod pod.

It reuses the account's existing GitHub OIDC provider (the platform's deploy/CI roles already created one; there can be only one per account) — auto-discovered by URL, so nothing needs pasting.

Apply#

bash
cd infra/terraform/github-oidc
terraform init \
  -backend-config="bucket=<your-terraform-state-bucket>" \
  -backend-config="key=github-oidc/terraform.tfstate" \
  -backend-config="region=us-east-1"

# If the models bucket isn't named "oshun-models", pass its name:
terraform apply -var 'models_bucket_name=<bucket>' -var 'allowed_repositories=["GreyChimp/oshun"]'

If the account has no GitHub OIDC provider yet (unlikely — deploy-ecs.yml already uses one), add -var create_oidc_provider=true to create it here.

Wire up the workflow#

bash
# 1. Set the role ARN as the workflow's secret
gh secret set AWS_MODEL_SYNC_ROLE_ARN --body "$(terraform output -raw model_sync_role_arn)"

# 2. Remove the now-unused long-lived keys
gh secret delete AWS_ACCESS_KEY_ID
gh secret delete AWS_SECRET_ACCESS_KEY

The role trusts repo:<owner>/<repo>:* and is allowed only s3:ListBucket + s3:GetObject on the models bucket. Its short-lived STS session credentials are what the ephemeral RunPod pod receives (see .github/workflows/model-sync.yml).