-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Plugin installer doesn't filter by protocol version during installation ("Incompatible API version with plugin") #19221
Comments
Im seeing this with the "AzureRM" and "Random" providers whilst testing v0.12.0-alpha2
Its not clear if there is some workaround or different versions to get around this or i should wait it out to be fixed in the coming days? |
@TheMacStack you have a few options. The providers bundled with the alpha release will work if you drop them in the same directory as your terraform configuration files. You can also try build any additional providers you want to test on 0.12-alpha* yourself; you will need to update them to use the latest version of terraform. I am also aiming to release another alpha bundle early this week if you'd like to wait and use those providers, though the same caveat remains - the provider binaries bundled with the alpha need to be moved alongside your terraform configuration files are in, or in one of the well-known plugin directories. |
Hi @TheMacStack! There are now a few different situations we've seen that lead to this symptom:
Reasons 1 and 3 cannot apply to you here, because you are clearly using two providers that are included in the alpha2 archive and we can see That leaves reason 2 as the remaining option for the moment. Do you have version constraints in your configuration? If so, does it help to temporarily remove them? If this is not the case then it is possible you've found a new bug we haven't seen yet. |
Thanks for the replies, I tried with and without any version constraints but it diddnt appear to help. I have a container image that i use as a build bot in ci/cd, pre built with a fork of your Kubernetes Provider (in ~/.terraform.d/plugins/) and some other utils (kubectl, helm etc), maybe the presence of the custom provider is throwing it off? (it is not used in the config from above example but is present in the image.) I'll keep playing with it and post back if i work it out, excited for tf 12! Thanks for your efforts. |
Once |
can someone describe what directories from alpha2 zip-file need to be moved into projects .terraform/ dir? |
This is what I did on my Mac: in that zip it contains
I copied |
Here's a different way to do it, which is what we've been doing for testing:
The advantage of this approach is you can keep everything separate from your "real" Terraform installation and working directory and so avoid problems both with upgrading and downgrading again later. |
I understand this is unrelated but, any plans on supporting provisioners the same way as providers. As in, making them work with |
Installable provisioners are not in scope for Terraform v0.12, and we've not yet planned any subsequent releases. Let's keep this focused on the topic of making the plugin installer filter by provider version. |
We are using the consul and vsphere provider, which are not present in the alpha bundle, and are getting the |
In order to keep the overhead of preparing the alpha releases low we included only a subset of the plugins since it requires doing a custom build of an existing version against an updated provider SDK. In principle you can do this yourself if you have a Go toolchain by upgrading the vendored copy of the Terraform repository to the v0.12.0-alpha2 tag and building it, after which you can copy the built binary into the same directory where you extracted everything else. There will be 0.12-compatible provider releases available for automatic installation before we get to the beta releases though, so don't worry about the v0.12.0 final release taking you by surprise... given the scope of this release we'll have at least two beta releases before final, to maximize the opportunities to exercise as many different edges of different providers as possible. |
@apparentlymart Thank you for the feedback. I'll take a stab at compiling as it is always nice to be able to give some constructive feedback. |
`$ ./terraform plan Error: Failed to instantiate provider "kubernetes" to obtain schema: Incompatible API version with plugin. Plugin version: 4, Client versions: [5] $ ./terraform version
./terraform plan Seeing the same issue - any update on this please ? |
@apparentlymart if I wish to test the openstack module with 0.12, how to proceed? Should I ping the folks at the provider's github page? 'Cause I see some test provider bundled here at terraform core @ alpha2.. 🤔 |
I can't provide instructions for individual providers since each of them has its own dependencies and thus different challenges in getting the SDK upgraded which the individual provider teams are in a better position to handle. Some providers might be straightforward for those who are already familiar with Go dependency management, but others require more care due to common transitive dependencies with Terraform Core that may need to be carefully managed during upgrade. The easiest solution if you're not a member of a provider dev team is to wait until 0.12.0-beta1, which will come once all (or at least, almost all) providers have 0.12-compatible versions available for installation from the main releases repository. That will be the opportunity to cautiously test against real infrastructure, while the alphas are there to exercise the general language features against temporary placeholder infrastructure from the subset of providers that are included. |
@splashx if you feel comfortable recompiling Otherwise as @apparentlymart suggested, perhaps wait for a downloadable v0.12 |
This recompile method seems to work for any provider/provisioner I've run into so far. This example is with cd $GOPATH/src/github.com/terraform-providers
git clone https://github.com/terraform-providers/terraform-provider-external.git
cd terraform-provider-external
rm -rf vendor
govendor init
govendor fetch github.com/hashicorp/terraform/...@=v0.12.0-alpha2
govendor fetch +m
go build you should see the 0.12 binary |
This is now fixed in master by #19977, and will be included in the forthcoming 0.12.0 final release. There are not any compatible providers available for installation yet, so trying master right now will lead to a different error message about that. v0.12-compatible providers (that is, providers compatible with protocol version 5) will be gradually released in the coming weeks. |
Appreciate all your hard work. Not sure how anyone is could realistically use terraform above 0.11.x without compatible providers that can be downloaded by the init command. @apparentlymart Any more details (other than "in the coming weeks") to get providers available with protocol version 5? |
Used the govendor recompile approach detailed by @sjwl for the azurerm provider. It compiled cleanly, but attempting to use it in a "plan" command resulted in:
|
I've been able to get the latest AWS provider and latest Terraform 0.12 dev working together by using Go modules and a little trickery. I'm guessing the same method would work with other providers. It's all detailed here: |
As an interim solution we've published a set of development snapshots, which are builds directly from the master branch at the date and time included in their version numbers. As I write this they are just over one week old, because there have not been significant changes since then. These are the best way to test in the mean time while we work towards the beta1 release. There were some challenges in getting the provider upgrades done while other provider work continued, so at present only a small number of providers have 0.12.0-compatible releases available for automatic installation with Look out for the v0.12.0-beta1 announcement soon. In the mean time, the snapshot releases are probably more convenient than building from source to test. |
I'm bumping into this issue now with 0.12.0-beta2. I tried to go to the providers snapshot page and downloaded the dev20190415H16 version. Since that didn't work ( $ terraform init
Initializing modules...
Initializing the backend...
Initializing provider plugins...
The following providers do not have any version constraints in configuration,
so the latest version was installed.
To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.
* provider.github: version = "~> 1.4"
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.
$ terraform version
Terraform v0.12.0-dev20190415H16
+ provider.github v1.4.0-dev20190415h16-dev
$ ls .terraform/plugins/linux_amd64/
lock.json terraform-provider-github_v1.4.0-dev20190415H16-dev_x4
$ terraform plan
Error: Failed to instantiate provider "github" to obtain schema: Incompatible API version with plugin. Plugin version: 4, Client versions: [5]
Is this expected? Am I doing something wrong? |
It seems like some of the You may have better luck with the The focus of the Terraform team at HashiCorp is on getting first-class releases out that are compatible with v0.12, so I expect we will not be able to make any further dev snapshot releases without delaying the release. With that said, unfortunately I think that means that for the sake of beta2 we'll need to focus testing on the providers that are either already v0.12-compatible in a real release (there are 20 of these at the time of writing, including Sorry for that oversight in the snapshot build process... it's a batch job that ran mostly unattended, building from the latest master branch of each repository, so the functionality of those releases cannot be guaranteed. (They are, essentially, "nightly builds", albeit not running nightly.) |
Do the following command: |
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. |
At the time of writing in
master
, and in the v0.12.0-alpha1 build, we have partially-implemented support for auto-installing providers via the Terraform Registry.This is currently lacking a mechanism to filter plugins by supported protocol version, and so the alpha1 build and any other builds made before this is fixed will see
terraform init
seem to successfully install plugins that are not actually compatible:...but then any follow-up command will produce a compatibility error:
The registry protocol changes to allow Terraform to recognize and filter by plugin protocol version are in progress but did not complete before alpha1. In the final release this will be handled during
terraform init
and will produce a more informative error message:The text was updated successfully, but these errors were encountered: