Bump installer protocol version to 5 and separate client and server protocol references

This commit is contained in:
findkim 2019-01-16 13:00:08 -06:00
parent 4e14ab7557
commit 7816e61614
4 changed files with 18 additions and 7 deletions

View File

@ -14,7 +14,6 @@ import (
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/helper/copy"
"github.com/hashicorp/terraform/plugin"
"github.com/hashicorp/terraform/plugin/discovery"
"github.com/hashicorp/terraform/providers"
"github.com/hashicorp/terraform/terraform"
@ -804,7 +803,7 @@ func TestImport_pluginDir(t *testing.T) {
Ui: cli.NewMockUi(),
},
providerInstaller: &discovery.ProviderInstaller{
PluginProtocolVersion: plugin.Handshake.ProtocolVersion,
PluginProtocolVersion: discovery.PluginInstallProtocolVersion,
},
}
if code := initCmd.Run(nil); code != 0 {

View File

@ -21,7 +21,6 @@ import (
"github.com/hashicorp/terraform/configs/configupgrade"
"github.com/hashicorp/terraform/internal/earlyconfig"
"github.com/hashicorp/terraform/internal/initwd"
"github.com/hashicorp/terraform/plugin"
"github.com/hashicorp/terraform/plugin/discovery"
"github.com/hashicorp/terraform/states"
"github.com/hashicorp/terraform/terraform"
@ -85,7 +84,7 @@ func (c *InitCommand) Run(args []string) int {
c.providerInstaller = &discovery.ProviderInstaller{
Dir: c.pluginDir(),
Cache: c.pluginCache(),
PluginProtocolVersion: plugin.Handshake.ProtocolVersion,
PluginProtocolVersion: discovery.PluginInstallProtocolVersion,
SkipVerify: !flagVerifyPlugins,
Ui: c.Ui,
Services: c.Services,

View File

@ -4,6 +4,12 @@ import (
"bytes"
)
// PluginInstallProtocolVersion is the protocol version TF-core
// supports to communicate with servers, and is used to resolve
// plugin discovery with terraform registry, in addition to
// any specified plugin version constraints
const PluginInstallProtocolVersion = 5
// PluginRequirements describes a set of plugins (assumed to be of a consistent
// kind) that are required to exist and have versions within the given
// corresponding sets.

View File

@ -7,11 +7,18 @@ import (
"github.com/hashicorp/terraform/terraform"
)
// The constants below are the names of the plugins that can be dispensed
// from the plugin server.
const (
// The constants below are the names of the plugins that can be dispensed
// from the plugin server.
ProviderPluginName = "provider"
ProvisionerPluginName = "provisioner"
// DefaultProtocolVersion is the protocol version assumed for legacy clients that don't specify
// a particular version during their handshake. This is the version used when Terraform 0.10
// and 0.11 launch plugins that were built with support for both versions 4 and 5, and must
// stay unchanged at 4 until we intentionally build plugins that are not compatible with 0.10 and
// 0.11.
DefaultProtocolVersion = 4
)
// Handshake is the HandshakeConfig used to configure clients and servers.
@ -21,7 +28,7 @@ var Handshake = plugin.HandshakeConfig{
// one or the other that makes it so that they can't safely communicate.
// This could be adding a new interface value, it could be how
// helper/schema computes diffs, etc.
ProtocolVersion: 4,
ProtocolVersion: DefaultProtocolVersion,
// The magic cookie values should NEVER be changed.
MagicCookieKey: "TF_PLUGIN_MAGIC_COOKIE",