Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible API version with plugin. Plugin version: 2, Ours: 4 #16077

Closed
scshitole opened this issue Sep 12, 2017 · 24 comments
Closed

Incompatible API version with plugin. Plugin version: 2, Ours: 4 #16077

scshitole opened this issue Sep 12, 2017 · 24 comments
Labels

Comments

@scshitole
Copy link

scshitole commented Sep 12, 2017

I was using terraform 0.8.1
shitole$ terraform version
Terraform v0.8.1

Your version of Terraform is out of date! The latest version
is 0.10.4. You can update by downloading from www.terraform.io
SJC-ML-SHITOLE:~ shitole$

Setup a new test environment with terraform 0.10 on ubuntu

terraform plan
Error asking for user input: 1 error(s) occurred:

  • provider.bigip: Incompatible API version with plugin. Plugin version: 2, Ours: 4
    scs@scs:~/dev/src/github.com/terraform-provider-bigip$

scs@scs:~/dev/src/github.com/terraform-provider-bigip$ terraform version
Terraform v0.10.4

scs@scs:~/dev/src/github.com/terraform-provider-bigip$

@apparentlymart
Copy link
Contributor

Hi @scshitole! Sorry for the problems here.

The plugin protocol has change a couple times between 0.8 and 0.10. It looks like you're using a plugin binary that was built for version 0.8, which is therefore not compatible with Terraform 0.10.

I assume the provider you're referring to here is your own terraform-provider-bigip repository. I notice that it has a version of Terraform from the 0.8.0 series in the vendor directory. If you upgrade this vendored version to current master or to one of the 0.10 release tags and then rebuild the plugin I think this error will go away.

If you need to support both versions during a transition, you can make use of Terraform 0.10's provider versioning capability by naming your new binary (for example) terraform-provider-bigip_v0.3.0 , which will make it invisible to Terraform 0.8.1 (it doesn't understand that newer naming scheme). You can then request the new version in configurations where you're using 0.10, like this:

provider "bigip" {
  version = "0.3.0"

  # ...
}

@scshitole
Copy link
Author

scshitole commented Sep 13, 2017 via email

@apparentlymart
Copy link
Contributor

Hi @scshitole,

Unfortunately that's a bit hard to read since it seems the GitHub email gateway had some trouble with the formatting 😖 but I see where you rebuilt the plugin executable and then when you ran terraform plan again (after re-initialization) you got the same error as before.

First I want to clarify that in the naming scheme terraform-provider-bigip_v0.3.0 I suggested, the v0.3.0 was intended to be the provider version, rather than a Terraform version. I picked 0.3.0 because the changelog in your repository showed 0.2.0 as being the latest, but you can choose any number you wish as long as it matches what you specify in your Terraform configuration.

I didn't see in your log a command to upgrade the vendored version of github.com/hashicorp/terraform; perhaps you did this before the go build command and didn't show it in the log, but in case not here's a govendor command to update this:

$ govendor fetch github.com/hashicorp/terraform

If this works, git status should show changes to the files in vendor/github.com/hashicorp/terraform, and in particular you should see const Version = "0.10.5" in the file vendor/github.com/hashicorp/terraform/terraform/version.go, indicating that the correct version was selected by govendor.

To confirm that Terraform is selecting the expected build of the plugin, you can run TF_LOG=debug terraform plan and you should see, near the top of the log, lines like this:

2017/09/13 11:42:23 [DEBUG] checking for provider in "."
2017/09/13 11:42:23 [DEBUG] found provider "terraform-provider-bigip_v0.8.0"
2017/09/13 11:42:23 [DEBUG] found valid plugin: "bigip"
2017/09/13 11:42:23 [DEBUG] checking for provider in "/home/scs/dev/src/github.com/terraform-provider-bigip"
2017/09/13 11:42:23 [DEBUG] checking for provider in ".terraform/plugins/linux_amd64"

If you see the "found provider" log line under one of the other checkign for provider in ... lines then that suggests that there is another copy of the plugin on your system that is being used instead of the one in the current directory. If you see this, please share these relevant lines from the log so I can see what Terraform is looking for and finding.

@scshitole
Copy link
Author

scshitole commented Sep 13, 2017 via email

@scshitole
Copy link
Author

scshitole commented Sep 13, 2017 via email

@apparentlymart
Copy link
Contributor

Hi @scshitole,

You can install govendor with this command:

go get -u github.com/kardianos/govendor

@scshitole
Copy link
Author

scshitole commented Sep 13, 2017 via email

@scshitole
Copy link
Author

scshitole commented Sep 14, 2017 via email

@scshitole
Copy link
Author

here I was able to do govendor fetch, I did build for vendor as well as for provider, also updated the version in .TF file, here are the logs
scs@scs:~/dev/src/github.com/terraform-provider-bigip$ terraform plan
Error asking for user input: 1 error(s) occurred:

  • provider.bigip: Incompatible API version with plugin. Plugin version: 2, Ours: 4
    scs@scs:/dev/src/github.com/terraform-provider-bigip$
    scs@scs:
    /dev/src/github.com/terraform-provider-bigip$ go get -u github.com/kardianos/govendor
    scs@scs:/dev/src/github.com/terraform-provider-bigip$ ls
    ~ launch_bigip.datagroup launch_bigip.lic launch_bigip.snmptraps Makefile
    bigip launch_bigip.dns launch_bigip.master launch_bigip.syslog README.md
    CHANGES.md launch_bigip.f5bigipmstbt10G launch_bigip.ntpdns launch_bigip.tcp-lan-profile statefile
    crash.log launch_bigip.fasthttp launch_bigip.oneConnect launch_bigip_tcp_wan_profile terraform-provider-bigip
    iapp.json launch_bigip.fastL4 launch_bigip.provision launch_bigip.tf terraform-provider-bigip_v0.3.0
    launch_bigip.asm1 launch_bigip.httpcompression launch_bigip.route launch_bigip.vlan vendor
    launch_bigip.back launch_bigip.iapp launch_bigip.selfipvlan LICENSE zoo.json
    launch_bigip.back1 launch_bigip.iapp2 launch_bigip.snmp main.go
    scs@scs:
    /dev/src/github.com/terraform-provider-bigip$ cd vendor/github.com/
    scs@scs:/dev/src/github.com/terraform-provider-bigip/vendor/github.com$ govendor fetch github.com/hashicorp/terraform
    scs@scs:
    /dev/src/github.com/terraform-provider-bigip/vendor/github.com$ cd../../
    -bash: cd../../: No such file or directory
    scs@scs:/dev/src/github.com/terraform-provider-bigip/vendor/github.com$ cd ..
    scs@scs:
    /dev/src/github.com/terraform-provider-bigip/vendor$ cd ..
    scs@scs:~/dev/src/github.com/terraform-provider-bigip$ terraform plan
    Error asking for user input: 1 error(s) occurred:

  • provider.bigip: Incompatible API version with plugin. Plugin version: 2, Ours: 4
    scs@scs:/dev/src/github.com/terraform-provider-bigip$ cd vendor/github.com/hashicorp/terraform/terraform/
    scs@scs:
    /dev/src/github.com/terraform-provider-bigip/vendor/github.com/hashicorp/terraform/terraform$ go build
    scs@scs:/dev/src/github.com/terraform-provider-bigip/vendor/github.com/hashicorp/terraform/terraform$ cd ../../../
    scs@scs:
    /dev/src/github.com/terraform-provider-bigip/vendor/github.com$ cd ../../
    scs@scs:~/dev/src/github.com/terraform-provider-bigip$ terraform plan
    Error asking for user input: 1 error(s) occurred:

  • provider.bigip: Incompatible API version with plugin. Plugin version: 2, Ours: 4
    scs@scs:/dev/src/github.com/terraform-provider-bigip$ ls
    ~ launch_bigip.datagroup launch_bigip.lic launch_bigip.snmptraps Makefile
    bigip launch_bigip.dns launch_bigip.master launch_bigip.syslog README.md
    CHANGES.md launch_bigip.f5bigipmstbt10G launch_bigip.ntpdns launch_bigip.tcp-lan-profile statefile
    crash.log launch_bigip.fasthttp launch_bigip.oneConnect launch_bigip_tcp_wan_profile terraform-provider-bigip
    iapp.json launch_bigip.fastL4 launch_bigip.provision launch_bigip.tf terraform-provider-bigip_v0.3.0
    launch_bigip.asm1 launch_bigip.httpcompression launch_bigip.route launch_bigip.vlan vendor
    launch_bigip.back launch_bigip.iapp launch_bigip.selfipvlan LICENSE zoo.json
    launch_bigip.back1 launch_bigip.iapp2 launch_bigip.snmp main.go
    scs@scs:
    /dev/src/github.com/terraform-provider-bigip$ rm terraform-provider-bigip
    scs@scs:~/dev/src/github.com/terraform-provider-bigip$ terraform plan
    Error asking for user input: 1 error(s) occurred:

  • provider.bigip: Incompatible API version with plugin. Plugin version: 2, Ours: 4
    scs@scs:/dev/src/github.com/terraform-provider-bigip$ go build -o terraform-provider-bigip_v0.3.0
    scs@scs:
    /dev/src/github.com/terraform-provider-bigip$ TF_LOG=debug terraform plan
    2017/09/14 13:38:49 [INFO] Terraform version: 0.10.4 10df48e
    2017/09/14 13:38:49 [INFO] Go runtime version: go1.9
    2017/09/14 13:38:49 [INFO] CLI args: []string{"/usr/local/bin/terraform", "plan"}
    2017/09/14 13:38:49 [DEBUG] Attempting to open CLI config file: /home/scs/.terraformrc
    2017/09/14 13:38:49 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
    2017/09/14 13:38:49 [INFO] CLI command args: []string{"plan"}
    2017/09/14 13:38:49 [INFO] command: empty terraform config, returning nil
    2017/09/14 13:38:49 [DEBUG] command: no data state file found for backend config
    2017/09/14 13:38:49 [DEBUG] New state was assigned lineage "d6a8e8d9-8f2d-4b28-985a-0f3bcc4023b9"
    2017/09/14 13:38:49 [INFO] command: backend initialized:
    2017/09/14 13:38:49 [DEBUG] checking for provider in "."
    2017/09/14 13:38:49 [DEBUG] found provider "terraform-provider-bigip_v0.3.0"
    2017/09/14 13:38:49 [DEBUG] checking for provider in "/usr/local/bin"
    2017/09/14 13:38:49 [DEBUG] checking for provider in ".terraform/plugins/linux_amd64"
    2017/09/14 13:38:49 [DEBUG] found valid plugin: "bigip"
    2017/09/14 13:38:49 [DEBUG] checking for provisioner in "."
    2017/09/14 13:38:49 [DEBUG] checking for provisioner in "/usr/local/bin"
    2017/09/14 13:38:49 [DEBUG] checking for provisioner in ".terraform/plugins/linux_amd64"
    2017/09/14 13:38:49 [INFO] command: backend is not enhanced, wrapping in local
    2017/09/14 13:38:49 [INFO] backend/local: starting Plan operation
    2017/09/14 13:38:49 [DEBUG] New state was assigned lineage "89a155bf-a7bb-4eec-b485-43e48e94889c"
    2017/09/14 13:38:49 [INFO] terraform: building graph: GraphTypeInput
    2017/09/14 13:38:49 [DEBUG] Resource state not found for "bigip_datagroup.datagroup1": bigip_datagroup.datagroup1
    2017/09/14 13:38:49 [TRACE] Graph after step *terraform.AttachStateTransformer:

bigip_datagroup.datagroup1 - *terraform.NodeAbstractResource
2017/09/14 13:38:49 [DEBUG] ReferenceTransformer: "provider.bigip" references: []
2017/09/14 13:38:49 [DEBUG] ReferenceTransformer: "bigip_datagroup.datagroup1" references: []
2017/09/14 13:38:49 [TRACE] Graph after step *terraform.ReferenceTransformer:

bigip_datagroup.datagroup1 - *terraform.NodeAbstractResource
provider.bigip - *terraform.NodeApplyableProvider
provider.bigip - *terraform.NodeApplyableProvider
2017-09-14T13:38:49.661-0700 [DEBUG] plugin: waiting for RPC address: path=/home/scs/dev/src/github.com/terraform-provider-bigip/terraform-provider-bigip_v0.3.0
2017/09/14 13:38:49 [ERROR] root: eval: *terraform.EvalInitProvider, err: Incompatible API version with plugin. Plugin version: 2, Ours: 4
2017/09/14 13:38:49 [ERROR] root: eval: *terraform.EvalSequence, err: Incompatible API version with plugin. Plugin version: 2, Ours: 4
2017/09/14 13:38:49 [TRACE] [walkInput] Exiting eval tree: provider.bigip
2017/09/14 13:38:49 [TRACE] dag/walk: upstream errored, not walking "bigip_datagroup.datagroup1"
Error asking for user input: 1 error(s) occurred:

  • provider.bigip: Incompatible API version with plugin. Plugin version: 2, Ours: 4
    2017-09-14T13:38:49.685-0700 [DEBUG] plugin.terraform-provider-bigip_v0.3.0: 2017/09/14 13:38:49 [DEBUG] plugin: plugin address: unix /tmp/plugin781720135
    2017-09-14T13:38:49.686-0700 [DEBUG] plugin: plugin process exited: path=/home/scs/dev/src/github.com/terraform-provider-bigip/terraform-provider-bigip_v0.3.0
    scs@scs:/dev/src/github.com/terraform-provider-bigip$ ls
    ~ launch_bigip.datagroup launch_bigip.lic launch_bigip.snmptraps Makefile
    bigip launch_bigip.dns launch_bigip.master launch_bigip.syslog README.md
    CHANGES.md launch_bigip.f5bigipmstbt10G launch_bigip.ntpdns launch_bigip.tcp-lan-profile statefile
    crash.log launch_bigip.fasthttp launch_bigip.oneConnect launch_bigip_tcp_wan_profile terraform-provider-bigip_v0.3.0
    iapp.json launch_bigip.fastL4 launch_bigip.provision launch_bigip.tf vendor
    launch_bigip.asm1 launch_bigip.httpcompression launch_bigip.route launch_bigip.vlan zoo.json
    launch_bigip.back launch_bigip.iapp launch_bigip.selfipvlan LICENSE
    launch_bigip.back1 launch_bigip.iapp2 launch_bigip.snmp main.go
    scs@scs:
    /dev/src/github.com/terraform-provider-bigip$

@scshitole
Copy link
Author

scshitole commented Sep 14, 2017 via email

@scshitole
Copy link
Author

scshitole commented Sep 14, 2017 via email

@apparentlymart
Copy link
Contributor

Hi again, @scshitole.

I'm sorry this isn't working out. I'm not sure what to suggest if you're still seeing this after upgrading the vendor directory to the latest version. If you can commit and push the changes to the vendor directory after upgrading Terraform (feel free to use a new branch, if you'd rather not update master), maybe I can pull from your repository and reproduce your situation on my development environment and investigate further.

@scshitole
Copy link
Author

scshitole commented Sep 14, 2017 via email

@apparentlymart
Copy link
Contributor

Hi @scshitole! Thanks for sharing that.

In the version.go file I still see const Version = "0.8.0", so it looks like the govendor fetch didn't work. I'm not sure why that would be. 🤔 I'll try it out locally and see if I can find some steps that work.

@apparentlymart
Copy link
Contributor

After cloning your repository and moving it to $GOPATH/src/github.com/terraform-provider-bigip (to match your import paths) I ran the following commands:

$ govendor fetch github.com/hashicorp/terraform/...
$ govendor fetch github.com/hashicorp/go-plugin/...
$ git add vendor
$ git commit -m "Upgrade vendored Terraform to 0.10"
$ go install .

After this I had a binary $GOPATH/bin/terraform-provider-bigip that was built against Terraform 0.10. Hopefully the same works for you! (I put mine at that path because I have $GOPATH/bin/terraform; you may need to place your file in a different location, such as the current working directory, depending on how you have installed Terraform.)

@scshitole
Copy link
Author

scshitole commented Sep 15, 2017 via email

@apparentlymart
Copy link
Contributor

Hi @scshitole,

This error is coming from some internal checks that the helper/schema library does to ensure that providers comply with the usual Terraform provider naming conventions. These validation checks became more sophisticated at some point between 0.8 and 0.10.

In particular, it seems like this provider was using "camel-case" names for fields, which is not correct style... Terraform resources should always have underscore-separated names.

Unfortunately I think the only way to get past these errors is to change the names to match usual convention, though of course that will be a breaking change for any configurations already using these resources. @radeksimko (since you have dealt with most of the work to comply with these conventions) is there anything @scshitole can do here to migrate gracefully to underscore-separated names, without breaking existing states, etc?

@scshitole
Copy link
Author

scshitole commented Sep 15, 2017 via email

@radeksimko
Copy link
Member

is there anything @scshitole can do here to migrate gracefully to underscore-separated names, without breaking existing states, etc?

Yes, the validation intentionally excludes Deprecated & Removed fields, so these can be gradually phased out. Sorry for the inconvenience, but the overall intention is to bring some uniformity to all provider codebases, so that folks familiar with one provider can more easily read & understand another one and review & contribute without much confusion. Unifying naming convention is a first step towards that direction. I ran tests across all our internal 69 providers and there was only a handful of fields which needed changing to comply with this. Unfortunately we have no easy way to track 3rd party providers (like F5) and see how it affects them, but these schema validations are in fact one way of communicating conventions.

But these I cannot change as these are part of the API for F5 BIG IP.

I'm not sure what do you mean by "cannot change" 🤔 The schema doesn't need to have field names matching the fields in the API? in fact it usually doesn't.

@scshitole
Copy link
Author

scshitole commented Sep 15, 2017 via email

@scshitole
Copy link
Author

scshitole commented Sep 16, 2017 via email

@apparentlymart
Copy link
Contributor

In glad it worked, @scshitole!

Sorry for all the hurdles. It sounds like you have what you need now, so I'm going to close this.

@scshitole
Copy link
Author

scshitole commented Sep 17, 2017 via email

@ghost
Copy link

ghost commented Apr 7, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants