github.com/ticketmaster/terraform@v0.10.0-beta2.0.20170711045249-a12daf5aba4f/plugins.go (about)

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