From e0f2235f666efcf01d0ac3fa69cf5423592f22bb Mon Sep 17 00:00:00 2001 From: James Bardin Date: Thu, 1 Jun 2017 14:36:30 -0400 Subject: [PATCH] update init command with new GetProvider signature GetProvider needs the plugin protocol version to be passed in --- command/init.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/command/init.go b/command/init.go index 7afeb88304..ab957ac87a 100644 --- a/command/init.go +++ b/command/init.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform/config" "github.com/hashicorp/terraform/config/module" "github.com/hashicorp/terraform/helper/variables" + "github.com/hashicorp/terraform/plugin" "github.com/hashicorp/terraform/plugin/discovery" "github.com/hashicorp/terraform/terraform" ) @@ -24,7 +25,7 @@ type InitCommand struct { // them into the dst directory. // This uses discovery.GetProvider by default, but it provided here as a // way to mock fetching providers for tests. - getProvider func(dst, provider string, req discovery.Constraints) error + getProvider func(dst, provider string, req discovery.Constraints, protoVersion uint) error } func (c *InitCommand) Run(args []string) int { @@ -222,7 +223,7 @@ func (c *InitCommand) getProviders(path string, state *terraform.State) error { dst := c.pluginDir() for provider, reqd := range missing { - err := c.getProvider(dst, provider, reqd.Versions) + err := c.getProvider(dst, provider, reqd.Versions, plugin.Handshake.ProtocolVersion) // TODO: return all errors if err != nil { return err