Federated Identity
Federated identity lets an external OIDC issuer — most commonly GitHub Actions — call the Terrakube API and CLI directly, using a short-lived token minted by that provider. This replaces storing a long-lived Personal Access Token or Team Token as a CI/CD secret: the pipeline requests an OIDC token from its own provider at run time, and Terrakube trusts it because you've registered that issuer ahead of time.

How it works
A superuser registers a federated credential with a name, the OIDC issuer URL (e.g.
https://token.actions.githubusercontent.comfor GitHub Actions), and the expected audience (e.g.api://Terrakube). Tokens whoseaudis a list are accepted when any entry matches, and claim conditions can match list-valued claims.A team is created in Terrakube whose name exactly matches the federated credential's name. Permissions for federated callers come entirely from this team's assignments — there's no separate permission model for federated identity.
When a request arrives with a JWT whose
issandaudclaims match a registered federated credential, Terrakube verifies the token's signature against that issuer's own JWKS endpoint (instead of your normal Dex/OIDC provider), and treats the caller as a member of the matching team.If the token doesn't match any registered issuer/audience pair, Terrakube falls back to normal authentication (Dex, PAT, or team token).
Claim conditions
By default, any valid token from a registered issuer/audience is trusted. To narrow that down — for example, to only trust workflows from one specific repository — add one or more claim conditions to the federated credential. Every condition must match the token for it to be accepted (logical AND).
Common claims to scope by, per provider:
GitHub Actions
repository
terrakube-io/terrakube
A specific repository
GitHub Actions
repository_owner
terrakube-io
Any repository under an org/user
GitHub Actions
ref
refs/heads/main
A specific branch
GitHub Actions
environment
production
Runs against a specific GitHub environment
GitLab CI
groups_direct
terrakube-io
Members of a specific GitLab group
Azure AD
amr
(issuer-specific)
A specific authentication method reference
Setting up GitHub Actions as a federated identity provider
Register the federated credential
In Organization Settings > Federated Credentials, click Create federated credential and set:
Name:
github-actions(this must match the team name in the next step)Issuer URL:
https://token.actions.githubusercontent.comAudience:
api://Terrakube

Create a matching team
Create a team named github-actions (see Team Management) and grant it whatever permissions the pipeline needs — for example, Manage Workspaces on the relevant project.
A registered federated credential also authenticates requests to the module/provider registry (e.g. terraform init pulling a private module in CI), using the same issuer/audience/claim rules configured above — there's nothing separate to set up for the registry.
Last updated
Was this helpful?