Fix Terraform Error - Plugin Crashed
Fix the Terraform plugin crashed error caused by corrupt providers, version incompatibility, or provider bugs. Clear cache, upgrade, and debug crash logs.
Troubleshooting
Fix the Terraform provider configuration not present error. Covers missing providers in modules, provider aliasing, required_providers blocks, and state moves.
A resource in state references a provider that isn't configured in your current Terraform files. Add the missing provider block, pass providers to modules explicitly, or remove the orphaned resource from state.
Error: Provider configuration not present
To work with aws_instance.web its original provider configuration
at provider["registry.terraform.io/hashicorp/aws"] is required,
but it has been removed. This occurs when a provider configuration
is removed while objects created by that provider still exist in
the state.Error: Provider configuration not present
To work with module.network.aws_vpc.main its original provider
configuration at module.network.provider["registry.terraform.io/hashicorp/aws"].west
is required, but it has been removed.You deleted the provider "aws" {} block but resources using it still exist in state.
You had provider "aws" { alias = "west" } and removed it while resources using provider = aws.west are still in state.
A child module needs a provider that wasn't explicitly passed via the providers argument.
Resources were moved or refactored, and the state still references the old provider configuration.
# If you removed the provider, add it back
provider "aws" {
region = "us-east-1"
}
# If it was an aliased provider
provider "aws" {
alias = "west"
region = "us-west-2"
}provider "aws" {
region = "us-east-1"
}
provider "aws" {
alias = "west"
region = "us-west-2"
}
module "network" {
source = "./modules/network"
# Explicitly pass providers to the module
providers = {
aws = aws # Default provider
aws.west = aws.west # Aliased provider
}
}In the module:
# modules/network/providers.tf
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
configuration_aliases = [aws.west]
}
}
}# List all resources in state
terraform state list
# Remove the orphaned resource (doesn't delete the real resource)
terraform state rm aws_instance.old_server
# Or remove a module's resources
terraform state rm module.old_networkIf the provider changed (e.g., moved from hashicorp/aws to a custom registry):
# Replace the provider in state
terraform state replace-provider \
"registry.terraform.io/hashicorp/aws" \
"registry.terraform.io/hashicorp/aws"# Use moved blocks (Terraform 1.1+)
moved {
from = aws_instance.old
to = module.compute.aws_instance.main
}# Or use state mv
terraform state mv aws_instance.old module.compute.aws_instance.main| Scenario | Cause | Fix |
|---|---|---|
| Removed provider block | Resources still in state | Add provider back or state rm |
| Removed provider alias | Resources use provider = aws.west | Add alias back or state rm |
| Module doesn't receive provider | Missing providers argument | Add providers = { aws = aws } |
| Changed provider source | Registry URL changed | state replace-provider |
| Refactored modules | Resources moved | state mv or moved blocks |
providers passthrough?terraform state list)state rm it?terraform state list before removing provider blocksmoved blocks when refactoring — keeps state consistentrequired_providers in all modules — makes dependencies explicitProvider not present errors mean state references a provider that no longer exists in your config. Add the provider block back, pass it to modules with the providers argument, or remove orphaned resources from state with terraform state rm. Always check terraform state list before removing providers.
Fix the Terraform plugin crashed error caused by corrupt providers, version incompatibility, or provider bugs. Clear cache, upgrade, and debug crash logs.
Fix the Terraform 'Backend configuration changed' error. Migrate state between backends (local to S3, S3 to S3), resolve lock conflicts
Fix Terraform provider version conflicts between modules, lock files, and constraint mismatches. Resolve dependency lock errors, upgrade providers safely
Fix the Terraform 'Reference to undeclared resource' error. Causes include typos, missing resources, wrong module references, and for_each/count confusion.