Auth Modules
Kyku supports multiple authentication strategies, from environment variables to OIDC-based temporary credentials in CI/CD.
Auth Architecture
Section titled “Auth Architecture”The @kykucloud/core/auth module abstracts credential resolution:
interface AuthConfig { provider: 'aws' | 'gcp' | 'hetzner' | 'digitalocean'; env: string; // OIDC-specific awsRoleArn?: string; gcpWorkloadProvider?: string; gcpServiceAccount?: string;}The auth module resolves credentials in priority order:
- OIDC (if CI environment detected and OIDC config present)
- Env vars (standard cloud SDK credentials)
- Config/SDK default chains (AWS profile, GCP ADC)
AWS Authentication
Section titled “AWS Authentication”Standard Env Vars
Section titled “Standard Env Vars”export AWS_REGION=us-east-1export AWS_ACCESS_KEY_ID=...export AWS_SECRET_ACCESS_KEY=...OIDC (CI/CD)
Section titled “OIDC (CI/CD)”Kyku auto-detects CI platforms and exchanges OIDC tokens for AWS credentials:
env: KYKU_AWS_ROLE_ARN: arn:aws:iam::123456789012:role/KykuDeployRoleThe exchange uses STS AssumeRoleWithWebIdentity:
- Reads OIDC token from CI platform (GitHub:
ACTIONS_ID_TOKEN_REQUEST_URL) - Calls
STS AssumeRoleWithWebIdentitywith the token and role ARN - Injects temporary
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_SESSION_TOKENas env vars - Standard SDK picks them up automatically
AWS SSO
Section titled “AWS SSO”aws sso login --profile my-profileexport AWS_PROFILE=my-profileKyku reads the SSO-sourced credentials from the shared credentials file via the standard SDK credential chain.
GCP Authentication
Section titled “GCP Authentication”Application Default Credentials (ADC)
Section titled “Application Default Credentials (ADC)”gcloud auth application-default loginService Account Key File
Section titled “Service Account Key File”export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.jsonexport GOOGLE_PROJECT_ID=my-projectOIDC (CI/CD)
Section titled “OIDC (CI/CD)”Two approaches:
1. Using google-github-actions/auth (recommended for GitHub Actions):
- uses: google-github-actions/auth@v2 with: workload_identity_provider: projects/123/...2. Direct OIDC via Kyku env vars:
env: KYKU_GCP_WORKLOAD_PROVIDER: projects/123/locations/global/workloadIdentityPools/my-pool/providers/github KYKU_GCP_PROJECT_ID: my-projectKyku uses google-auth-library for ADC and OIDC token exchange. Tokens are cached with a 1-minute margin before expiry.
Hetzner Authentication
Section titled “Hetzner Authentication”Hetzner Cloud API does not support OIDC. Use API tokens:
export HCLOUD_TOKEN=your-cloud-tokenAdditional tokens for Hetzner DNS and S3:
export HETZNER_DNS_TOKEN=your-dns-tokenexport HETZNER_S3_ACCESS_KEY=your-s3-keyexport HETZNER_S3_SECRET_KEY=your-s3-secretDigitalOcean Authentication
Section titled “DigitalOcean Authentication”export DIGITALOCEAN_TOKEN=your-api-tokenexport DO_SPACES_ACCESS_KEY=your-spaces-keyexport DO_SPACES_SECRET_KEY=your-spaces-secretProvider Detection
Section titled “Provider Detection”The auth module returns early for token-based providers:
function resolveAuth(config: AuthConfig): AuthResult { if (config.provider === 'hetzner' || config.provider === 'digitalocean') { // Token-based — no OIDC exchange needed return { type: 'token' }; }
if (isCI() && hasOidcConfig(config)) { return exchangeOidcToken(config); }
// Rely on SDK credential chain (env vars, config file, etc.) return { type: 'sdk-default' };}CI Platform Detection
Section titled “CI Platform Detection”Kyku detects CI platforms by checking environment variables:
| Platform | Detection Env Var |
|---|---|
| GitHub Actions | GITHUB_ACTIONS |
| GitLab CI | GITLAB_CI |
| CircleCI | CIRCLECI |
| Jenkins | JENKINS_HOME |
Token Caching
Section titled “Token Caching”For OIDC exchanges, the resulting credentials are cached to avoid repeated STS calls within a single plan/apply run:
- AWS temp creds expire in 1 hour (refreshed if needed)
- GCP access tokens cached with 1-minute margin before expiry
- Hetzner/DO tokens are static and don’t expire