Skip to content

Environment Variables

This page lists the environment variables and config files the homelab actually reads, grouped by the tool that consumes them. Every entry maps to a committed *.example file. Copy it, drop the .example suffix, and fill in the values.

The containerised runner and the Taskfile both load a .env file in the repo root. Taskfile.yaml reads it via dotenv: [".env"], and compose.yaml passes these four variables into the runner container.

Source: env.example. Run cp env.example .env.

VariablePurpose
BWS_ACCESS_TOKENBitwarden Secrets Manager access token. Bootstraps the External Secrets Operator and is used by the Kubernetes Ansible playbook.
CLOUDFLARE_API_TOKENCloudflare API token. Creates the R2 state bucket and is used by Terragrunt’s Cloudflare provider.
AWS_ACCESS_KEY_IDAccess key ID for the Cloudflare R2 (S3-compatible) bucket that holds Terragrunt remote state.
AWS_SECRET_ACCESS_KEYSecret access key for the same R2 bucket.

Per-environment settings (prod, non-prod) for VM provisioning and remote state. These are configured by editing the file. Each value also falls back to an environment variable through get_env(...), so it can be overridden without touching the file.

Source: terragrunt/infrastructure-live/prod/account.hcl.example

VariablePurpose
PVE_ENDPOINTProxmox VE API endpoint, for example https://<node>:8006/.
PVE_API_TOKENProxmox API token used to provision the Talos and TrueNAS VMs.
PVE_USERNAME, PVE_PASSWORDProxmox credentials, as an alternative to the API token.
PVE_AUTH_TICKET, PVE_CSRF_TOKENOptional Proxmox ticket-based auth.
CLOUDFLARE_ACCOUNT_IDCloudflare account ID. Also forms the R2 endpoint URL.
CLOUDFLARE_JURISDICTIONOptional R2 jurisdiction suffix, for example EU.
R2_BUCKET_NAMEName of the R2 remote-state bucket (default homelab-as-code).
TS_AUTHKEYTailscale auth key injected into the Talos nodes.
SourceWhat to set
TS_KEY env varTailscale auth key for the Proxmox nodes. Export it before running the playbook; the tailscale-bootstrap role reads it.
inventory.yml.examplePer-node ansible_host IPs and the ansible_user.
SourceWhat to set
host_vars/localhost.yml.exampleorganization_id and project_id for the Bitwarden ClusterSecretStore.

A standalone OpenTofu module that creates the R2 bucket before Terragrunt has a state backend. It is run once, then Terragrunt uses the bucket for everything else.

Sources: tofu/bootstrap-r2-bucket/env.example and terraform.tfvars.example.

VariablePurpose
CLOUDFLARE_API_TOKENCloudflare token with R2 permissions.
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEYR2 S3 credentials.
CLOUDFLARE_ACCOUNT_IDAccount ID used to build the R2 endpoint.
R2_BUCKET_NAMEBucket name (optional, has a default).
R2_LOCATIONBucket location hint (optional).
account_id (tfvar)Cloudflare account ID, set in terraform.tfvars.

For the accounts and tokens behind these variables, see Prerequisites.