Merge pull request #20030 from findkim/bump-plugin-install-version
Bump provider installer protocol version to 5
This commit is contained in:
commit
ba6e243bd9
|
@ -14,7 +14,6 @@ import (
|
||||||
|
|
||||||
"github.com/hashicorp/terraform/configs/configschema"
|
"github.com/hashicorp/terraform/configs/configschema"
|
||||||
"github.com/hashicorp/terraform/helper/copy"
|
"github.com/hashicorp/terraform/helper/copy"
|
||||||
"github.com/hashicorp/terraform/plugin"
|
|
||||||
"github.com/hashicorp/terraform/plugin/discovery"
|
"github.com/hashicorp/terraform/plugin/discovery"
|
||||||
"github.com/hashicorp/terraform/providers"
|
"github.com/hashicorp/terraform/providers"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
|
@ -804,7 +803,7 @@ func TestImport_pluginDir(t *testing.T) {
|
||||||
Ui: cli.NewMockUi(),
|
Ui: cli.NewMockUi(),
|
||||||
},
|
},
|
||||||
providerInstaller: &discovery.ProviderInstaller{
|
providerInstaller: &discovery.ProviderInstaller{
|
||||||
PluginProtocolVersion: plugin.Handshake.ProtocolVersion,
|
PluginProtocolVersion: discovery.PluginInstallProtocolVersion,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if code := initCmd.Run(nil); code != 0 {
|
if code := initCmd.Run(nil); code != 0 {
|
||||||
|
|
|
@ -21,7 +21,6 @@ import (
|
||||||
"github.com/hashicorp/terraform/configs/configupgrade"
|
"github.com/hashicorp/terraform/configs/configupgrade"
|
||||||
"github.com/hashicorp/terraform/internal/earlyconfig"
|
"github.com/hashicorp/terraform/internal/earlyconfig"
|
||||||
"github.com/hashicorp/terraform/internal/initwd"
|
"github.com/hashicorp/terraform/internal/initwd"
|
||||||
"github.com/hashicorp/terraform/plugin"
|
|
||||||
"github.com/hashicorp/terraform/plugin/discovery"
|
"github.com/hashicorp/terraform/plugin/discovery"
|
||||||
"github.com/hashicorp/terraform/states"
|
"github.com/hashicorp/terraform/states"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
|
@ -85,7 +84,7 @@ func (c *InitCommand) Run(args []string) int {
|
||||||
c.providerInstaller = &discovery.ProviderInstaller{
|
c.providerInstaller = &discovery.ProviderInstaller{
|
||||||
Dir: c.pluginDir(),
|
Dir: c.pluginDir(),
|
||||||
Cache: c.pluginCache(),
|
Cache: c.pluginCache(),
|
||||||
PluginProtocolVersion: plugin.Handshake.ProtocolVersion,
|
PluginProtocolVersion: discovery.PluginInstallProtocolVersion,
|
||||||
SkipVerify: !flagVerifyPlugins,
|
SkipVerify: !flagVerifyPlugins,
|
||||||
Ui: c.Ui,
|
Ui: c.Ui,
|
||||||
Services: c.Services,
|
Services: c.Services,
|
||||||
|
|
|
@ -4,6 +4,12 @@ import (
|
||||||
"bytes"
|
"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
|
// PluginRequirements describes a set of plugins (assumed to be of a consistent
|
||||||
// kind) that are required to exist and have versions within the given
|
// kind) that are required to exist and have versions within the given
|
||||||
// corresponding sets.
|
// corresponding sets.
|
||||||
|
|
|
@ -7,11 +7,18 @@ import (
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The constants below are the names of the plugins that can be dispensed
|
|
||||||
// from the plugin server.
|
|
||||||
const (
|
const (
|
||||||
|
// The constants below are the names of the plugins that can be dispensed
|
||||||
|
// from the plugin server.
|
||||||
ProviderPluginName = "provider"
|
ProviderPluginName = "provider"
|
||||||
ProvisionerPluginName = "provisioner"
|
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.
|
// 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.
|
// 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
|
// This could be adding a new interface value, it could be how
|
||||||
// helper/schema computes diffs, etc.
|
// helper/schema computes diffs, etc.
|
||||||
ProtocolVersion: 4,
|
ProtocolVersion: DefaultProtocolVersion,
|
||||||
|
|
||||||
// The magic cookie values should NEVER be changed.
|
// The magic cookie values should NEVER be changed.
|
||||||
MagicCookieKey: "TF_PLUGIN_MAGIC_COOKIE",
|
MagicCookieKey: "TF_PLUGIN_MAGIC_COOKIE",
|
||||||
|
|
|
@ -14,7 +14,6 @@ import (
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
getter "github.com/hashicorp/go-getter"
|
getter "github.com/hashicorp/go-getter"
|
||||||
"github.com/hashicorp/terraform/plugin"
|
|
||||||
discovery "github.com/hashicorp/terraform/plugin/discovery"
|
discovery "github.com/hashicorp/terraform/plugin/discovery"
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
)
|
)
|
||||||
|
@ -150,12 +149,13 @@ func (c *PackageCommand) Run(args []string) int {
|
||||||
// FIXME: This is incorrect because it uses the protocol version of
|
// FIXME: This is incorrect because it uses the protocol version of
|
||||||
// this tool, rather than of the Terraform binary we just downloaded.
|
// this tool, rather than of the Terraform binary we just downloaded.
|
||||||
// But we can't get this information from a Terraform binary, so
|
// But we can't get this information from a Terraform binary, so
|
||||||
// we'll just ignore this for now as we only have one protocol version
|
// we'll just ignore this for now and use the same plugin installer
|
||||||
// in play anyway. If a new protocol version shows up later we will
|
// protocol version for terraform-bundle as the terraform shipped
|
||||||
// probably deal with this by just matching version ranges and
|
// with this release.
|
||||||
// hard-coding the knowledge of which Terraform version uses which
|
//
|
||||||
// protocol version.
|
// NOTE: To target older versions of terraform, use the terraform-bundle
|
||||||
PluginProtocolVersion: plugin.Handshake.ProtocolVersion,
|
// from the same tag.
|
||||||
|
PluginProtocolVersion: discovery.PluginInstallProtocolVersion,
|
||||||
|
|
||||||
OS: osName,
|
OS: osName,
|
||||||
Arch: archName,
|
Arch: archName,
|
||||||
|
|
Loading…
Reference in New Issue