Skip to content

Commit

Permalink
infra: add support TF_DATA_DIR
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeylanzman committed Jul 12, 2019
1 parent 6decc82 commit 12d5fc1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion terraform_utils/provider_wrapper/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ func (p *ProviderWrapper) Refresh(info *terraform.InstanceInfo, state *terraform
}

func (p *ProviderWrapper) initProvider() error {
pluginPath := command.DefaultDataDir + string(os.PathSeparator) + "plugins" + string(os.PathSeparator) + runtime.GOOS + "_" + runtime.GOARCH
defaultDataDir := os.Getenv("TF_DATA_DIR")
if defaultDataDir == "" {
defaultDataDir = command.DefaultDataDir
}
pluginPath := defaultDataDir + string(os.PathSeparator) + "plugins" + string(os.PathSeparator) + runtime.GOOS + "_" + runtime.GOARCH
files, err := ioutil.ReadDir(pluginPath)
if err != nil {
pluginPath = os.Getenv("HOME") + string(os.PathSeparator) + "." + command.DefaultPluginVendorDir
Expand Down

0 comments on commit 12d5fc1

Please sign in to comment.