Reputation: 491
I am using terraform version 0.13.2, provider http://registry.terraform.io/hashicorp/local v2.1.0 and have the following resource :
terraform {
required_providers {
local = {
source = "hashicorp/local"
}
}
required_version = ">= 0.13"
}
resource "local_file" "test_local_file" {
content = "This is a test file"
filename = "test.txt"
}
Now when I take only the terraform.tfstate file in another directory and try to destroy this configuration using terraform 1.1.2 in the new directory I get the following error on terraform destroy :
│ Error: Missing resource schema from provider
│
│ No resource schema found for local_file.
What is the fix?
Upvotes: 7
Views: 19753
Reputation: 51
I stumbled on the same issue while trying to run terraform apply
after removing the last resource from tf config, which also came from implicitly required provider (in my case it was time provider).
The solution for this was to destroy the state as well:
terraform destroy [resource id]
After this, apply should work again.
Upvotes: 0
Reputation: 19
Error: Missing resource schema from provider
i found the solution as - find the file with .tfstate extension and edit this as per the requirement. Or delete this file and run terraform init and terraform plan command. issue will be resolved.
Upvotes: 0
Reputation: 491
Using terraform v1.1.2, when you try to delete the configuration using only the state file terraform is somehow not able to fetch the local provider.
The fix is to include the local
provider block in the new directory along with the state file and then perform terraform init
, terraform apply
terraform {
required_providers {
local = {
source = "hashicorp/local"
}
}
}
Upvotes: 8