Interview Prep/Terraform/Dependencies, Cycles and Providers

Parallel CI jobs sharing `TF_PLUGIN_CACHE_DIR` fail intermittently with `text file busy` or corrupt provider zips.

AdvancedTroubleshootingDependencies, Cycles and Providers
Answer

Likely causes → The plugin cache is not safe for concurrent writes; two terraform init runs write the same provider at once.

Diagnose → Failures only when jobs run in parallel on the same host.

Fix → Give each job its own cache dir, or pre-populate the cache in the image (read-only use is safe). Use CI cache keyed on .terraform.lock.hcl hash.

Prevent → Treat the plugin cache as per-job or pre-baked, never shared-writable across concurrent jobs.

All Terraform questions Roadmap: Terraform

More on Dependencies, Cycles and Providers