Keyless CI/CD with Workload Identity Federation — GCP
Workload Identity Federation lets external identities (GitHub Actions, GitLab, AWS, Azure, any OIDC/SAML provider) obtain short-lived Google credentials — no JSON keys to leak or rotate. Setup steps Create a workload identity pool and an OIDC provider for your CI issuer. Add an attribute condition restricting which repositories/branches may authenticate. Grant roles/iam.workloadIdentityUser on a deploy service account to the matching principal set. In CI, exchange the job's OIDC token for Google credentials. Combine with Artifact Registry (images), Cloud Deploy (promotion pipelines with approvals) and Terraform state in a versioned Cloud Storage bucket.
Key Takeaways
Workload Identity Federation replaces long-lived service-account keys in CI.
Restrict which repositories and branches can authenticate with attribute conditions.
Grant the CI identity only workloadIdentityUser on a narrowly-scoped deploy account.
GitHub workflows need id-token: write permission for OIDC.