package main

import (
	"fmt"
	"log"
	"path/filepath"
	"runtime"
)

// globalPluginDirs returns directories that should be searched for
// globally-installed plugins (not specific to the current configuration).
//
// Earlier entries in this slice get priority over later when multiple copies
// of the same plugin version are found, but newer versions always override
// older versions where both satisfy the provider version constraints.
func globalPluginDirs() []string {
	var ret []string
	// Look in ~/.terraform.d/plugins/ , or its equivalent on non-UNIX
	dir, err := ConfigDir()
	if err != nil {
		log.Printf("[ERROR] Error finding global config directory: %s", err)
	} else {
		machineDir := fmt.Sprintf("%s_%s", runtime.GOOS, runtime.GOARCH)
		ret = append(ret, filepath.Join(dir, "plugins", machineDir))
	}

	return ret
}

package main

import (
	"log"
	"path/filepath"
)

// globalPluginDirs returns directories that should be searched for
// globally-installed plugins (not specific to the current configuration).
//
// Earlier entries in this slice get priority over later when multiple copies
// of the same plugin version are found, but newer versions always override
// older versions where both satisfy the provider version constraints.
func globalPluginDirs() []string {
	var ret []string
	// Look in ~/.terraform.d/plugins/ , or its equivalent on non-UNIX
	dir, err := ConfigDir()
	if err != nil {
		log.Printf("[ERROR] Error finding global config directory: %s", err)
	} else {
		ret = append(ret, filepath.Join(dir, "plugins"))
	}

	return ret
}

--- 
+++ 
@@ -1,8 +1,10 @@
 package main
 
 import (
+	"fmt"
 	"log"
 	"path/filepath"
+	"runtime"
 )
 
 // globalPluginDirs returns directories that should be searched for
@@ -18,7 +20,8 @@
 	if err != nil {
 		log.Printf("[ERROR] Error finding global config directory: %s", err)
 	} else {
-		ret = append(ret, filepath.Join(dir, "plugins"))
+		machineDir := fmt.Sprintf("%s_%s", runtime.GOOS, runtime.GOARCH)
+		ret = append(ret, filepath.Join(dir, "plugins", machineDir))
 	}
 
 	return ret
Add missing OS_ARCH dir to global plugin paths

When the global directory was added, the discovery system still
attempted to search for OS_ARCH subdirectories. It has since been
changed only search explicit paths.
