Terraform
Terraform CI on GitHub Actions
terraform init downloads every provider on every run.
70s → 4s
terraform init
terraform init downloads every provider on every run.
Why it happens
The plugin cache directory is not persisted, so providers are re-downloaded per job.
What to change
- Set TF_PLUGIN_CACHE_DIR and cache it keyed on the lock file
- Run plan and apply as separate jobs sharing the plan artefact
- Use -parallelism tuned to your provider's rate limits
Terraform on runnerhut
yaml
jobs: plan: runs-on: runnerhut-4vcpu-ubuntu-2404 env: TF_PLUGIN_CACHE_DIR: ~/.terraform.d/plugin-cache steps: - uses: actions/checkout@v4 - run: terraform init -input=false - run: terraform plan -out=tfplanThe only runnerhut-specific line is `runs-on: runnerhut-4vcpu-ubuntu-2404`. Everything else is standard GitHub Actions — the same actions, the same secrets and the same permissions model you use today.
Your next build could be twice as fast, at half the price
Start free. Migrating away is the same one line, and we publish that diff too.