Terraform "rpc error: code = Unavailable" provider crash in CI
A provider subprocess died during plan/apply -- a panic, an OOM kill, or a fatal bug -- so its RPC connection became Unavailable and Terraform could not continue.
What this error means
plan/apply fails with "rpc error: code = Unavailable" or "The plugin ... crashed!". It can be intermittent (memory pressure) or deterministic (a provider bug hit by specific input).
Error: Plugin did not respond
The plugin encountered an error, and failed to respond to the
plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain
more details.
Error: rpc error: code = Unavailable desc = transport is closingCommon causes
Provider crash or OOM
The plugin panicked or was killed (often memory pressure on a small runner with high parallelism), severing the RPC channel.
Provider bug on specific input
A defect in the provider version, triggered by a particular resource/config, makes it crash deterministically.
How to fix it
Retry, reduce parallelism, and check the crash log
Re-run with lower parallelism and more memory; inspect the crash log to tell transient from deterministic.
TF_LOG=trace terraform apply -input=false -parallelism=5
# inspect the generated crash log if present:
cat crash.log 2>/dev/null | head -40Address a deterministic crash
- If it crashes on the same input every time, upgrade or pin a provider version without the bug.
- Search the provider issue tracker for the panic signature.
- Reduce the blast radius with -target to isolate the offending resource while you patch.
How to prevent it
- Give Terraform enough memory and modest parallelism for large graphs.
- Pin provider versions and track their changelogs/known crashes.
- Run apply on a platform that auto-retries transient provider crashes.