github.com/davebizus/terraform-main@v0.11.12-beta1/plugins.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "log" 6 "path/filepath" 7 "runtime" 8 ) 9 10 // globalPluginDirs returns directories that should be searched for 11 // globally-installed plugins (not specific to the current configuration). 12 // 13 // Earlier entries in this slice get priority over later when multiple copies 14 // of the same plugin version are found, but newer versions always override 15 // older versions where both satisfy the provider version constraints. 16 func globalPluginDirs() []string { 17 var ret []string 18 // Look in ~/.terraform.d/plugins/ , or its equivalent on non-UNIX 19 dir, err := ConfigDir() 20 if err != nil { 21 log.Printf("[ERROR] Error finding global config directory: %s", err) 22 } else { 23 machineDir := fmt.Sprintf("%s_%s", runtime.GOOS, runtime.GOARCH) 24 ret = append(ret, filepath.Join(dir, "plugins")) 25 ret = append(ret, filepath.Join(dir, "plugins", machineDir)) 26 } 27 28 return ret 29 }