Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terraform Error message when executing terraform : Incompatible API version with plugin. Plugin version: 4, Client versions: [5]

terraform plan -var-file=xx gives me

Failed to instantiate provider "aws" to obtain schema: Incompatible API version with the plugin. Plugin version: 4, Client versions: [5]

terraform init doesn't have any issue.

Initializing the backend...

Initializing provider plugins...

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

anyone knows what is happening here and how can I resolve this.

terraform -v
Terraform v0.12.0-dev
+ provider.aws v1.2.0
like image 350
change198 Avatar asked Apr 12 '19 10:04

change198


2 Answers

If you changed versions of Terraform between 0.11 and then 0.12 on a project, you have downloaded the plugin for 0.11 and are now using version 0.12.

In the project root,

    $ rm -rf .terraform
    $ terraform init

and it will actually download the plugin versions for Terraform 12.

Initializing provider plugins...
 - Checking for available provider plugins...
 - Downloading plugin for provider "aws" (terraform-providers/aws) 2.13.0...
 - ```
like image 153
Jürgen Avatar answered Nov 22 '22 04:11

Jürgen


The new language features in Terraform v0.12 required some changes to the protocol Terraform uses to interact with provider plugins. These changes give Terraform CLI access to the resource type schemas of each provider, allowing for more helpful validation-related error messages and more predictable behavior. However, this means that provider releases built before v0.12 cannot be used.

It recommend upgrading to the latest versions of all providers you use and ensuring that terraform plan is working with them before upgrading to Terraform v0.12, since this allows you to reduce risk by changing only one component at a time, particularly if you will be adopting a new major version of a provider which may have breaking changes of its own.

You can find more information in the Terraform v0.12 Documentation here. Hope it'll help.

like image 28
Claire Bellivier Avatar answered Nov 22 '22 05:11

Claire Bellivier