Incompatible API version with plugin. Plugin version: 4, client versions: [5]

While issuing command… terraform 0.12upgrade… I am getting following error:
failed to load provider “template”: Incompatible API version with plugin. Plugin version: 4, client versions: [5]
Did not get any error for… terraform init
I am using same providers for other projects which I was able to upgrade to 0.12

I found this thread but does not work for me…

Hi @tp20165,

This message usually appears when Terraform is finding a manually-installed copy of the template provider on your system and trying to use that in preference to the normal automatic installation, if the manually-installed copy is too old to support Terraform 0.12.

In that other topic we saw Terraform’s internal logs (activated by setting the environment variable TF_LOG=TRACE before running Terraform) showing where the provider in question was coming from:

2019-08-23T16:07:53.558-0700 [DEBUG] plugin: starting plugin: path=/Users/miketitus/Workspace/git/spelljammer/clusters/dev-spelljammer/.terraform/plugins/darwin_amd64/terraform-provider-local_v1.1.0_x4 args=[/Users/miketitus/Workspace/git/spelljammer/clusters/dev-spelljammer/.terraform/plugins/darwin_amd64/terraform-provider-local_v1.1.0_x4]

In that case, the problem was a provider already available in the local auto-install cache under .terraform/plugins, but the fixes I shared there would not work for a plugin installed elsewhere on the system. If you run Terraform with that TF_LOG=TRACE environment variable set then you should see a similar log line just before the error message which will tell you which executable Terraform is using for the template provider.

If what you have is just a local copy of the official provider from releases.hashicorp.com then you could just delete your local copy and let terraform init install a newer version. If you have a local copy because you’ve modified the provider in some way, you may need to re-apply such modifications to the latest version of the provider and rebuild.

Thank You. Upgrading to latest version of template provider worked for me.