Terraform: Provider produced inconsistent final plan
The provider returned a value after apply that differs from what it promised at plan time. This is a provider bug or a case where the cloud API normalises a value (case, ordering, defaults) behind Terraform's back.
Quick fix
Read the commands before running them. Anything that restarts a service, deletes data or changes permissions should be tried on a non-production system first.
# 1. Upgrade the provider. Most of these are fixed upstream
terraform init -upgrade
# 2. Normalise the input yourself to match what the API returns
# (lowercase names, sorted lists, explicit defaults)
# 3. If the attribute is genuinely server-managed, ignore it
lifecycle {
ignore_changes = [tags["LastModified"]]
}
# 4. Capture detail for a bug report
TF_LOG=TRACE TF_LOG_PATH=tf.log terraform apply
How to diagnose Terraform errors
Terraform errors are mostly state errors. A stuck lock, a resource that exists in the cloud but not in state, or a value that cannot be known until apply time all trace back to how Terraform models the world. The for_each-on-unknown-values error is the most common conceptual stumble: Terraform must know the keys of a map at plan time, even if the values are unknown.
If the quick fix above does not resolve it, work through these steps. They apply to this whole class of error, not just to this one message, which is usually what saves the time.
- For a stuck lock, find out who holds it before forcing anything.
terraform force-unlock <id>is safe only when you are certain no apply is running. - Use
terraform state listandterraform state show <addr>to see what Terraform believes exists, andterraform importto adopt resources created outside it. - Set
TF_LOG=DEBUGandTF_LOG_PATH=tf.logfor provider-level detail on authentication and API errors. - For
for_eacherrors, restructure so keys come from static values or from variables, not from attributes of resources that do not yet exist. Use-targetfor a staged apply as a last resort. - Run
terraform plan -refresh-onlyto see drift explicitly before applying anything unexpected.
Tools worth reaching for
terraform state list/showTF_LOG=DEBUGterraform plan -refresh-onlyterraform graphtflint / checkov
Authoritative references
Primary documentation for this error, worth reading before applying any fix in production.
Related Terraform errors
- OpenTofu: state is encrypted but no key provider is configuredOpenTofu can encrypt state and plan files at rest. Once a state has been written encrypted…
- Terraform: An argument named "x" is not expected hereThe configuration uses an argument the provider schema does not have. Usually the provider is…
- Terraform: Cannot import resource - not foundThe resource ID provided to terraform import does not match any existing resource in the…
- Terraform: Cycle (resources depend on each other)Terraform builds a dependency graph from references and cannot order a cycle. Two resources…
- Terraform: Cycle dependency detectedCircular dependency in resource definitions, resources depend on each other in a loop.
- Terraform: Failed to install provider, could not query provider registryterraform init could not fetch a provider. Beyond plain network failure the frequent causes…
- Terraform: for_each value depends on resource attributes that cannot be determinedA for_each or count expression depends on a value that is not known until apply time…
- Terraform: Inconsistent dependency lock fileThe provider versions or platform hashes recorded in .terraform.lock.hcl do not cover what…
Browse other categories
- HTTP 494xx client errors, 5xx server errors, redirects, headers and protocol problems.
- JavaScript 42npm resolution, async pitfalls, hydration, memory limits and runtime type…
- Database 41Connections, deadlocks, constraints, replication and memory limits.
- AI 35Rate limits, context windows, GPU memory and model-serving failures.
- Network 35Refused connections, timeouts, resets, MTU problems and port exhaustion.
- Python 35Imports, virtual environments, encoding, concurrency and dependency conflicts.
- Kubernetes 34CrashLoopBackOff, ImagePullBackOff, OOMKilled, RBAC, scheduling and storage.
- Docker 27Daemon connectivity, disk space, image pulls, ports and architecture mismatches.
- System 26Disk space, systemd units, file descriptors, OOM killer and scheduled jobs.
- Cloud 25IAM permissions, quotas, service limits and credential failures.
- Security 25JWT validation, CSRF, OAuth grants, SELinux, SSH host keys and CSP.
- TLS 24Untrusted authorities, expiry, hostname mismatch, chains and cipher negotiation.
Something missing or wrong?
This entry is maintained by hand. If the fix is out of date, incomplete, or you have a better one, email a correction and it will be reviewed.