Skip to content

Commit

Permalink
Fix windows TFCloud creds path
Browse files Browse the repository at this point in the history
  • Loading branch information
Elie committed Sep 8, 2021
1 parent 8066995 commit 937eeb4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/iac/terraform/state/backend/tfcloud_config_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"io"
"io/ioutil"
"os"
"path/filepath"
"runtime"

Expand Down Expand Up @@ -48,9 +49,9 @@ func getTerraformConfigFile() (string, error) {
if err != nil {
return "", err
}
tfConfigDir := ".terraform.d"
basePath := filepath.Join(homeDir, ".terraform.d")
if runtime.GOOS == "windows" {
tfConfigDir = "terraform.d"
basePath = filepath.Join(os.Getenv("APPDATA"), "terraform.d")
}
return filepath.Join(homeDir, tfConfigDir, "credentials.tfrc.json"), nil
return filepath.Join(basePath, "credentials.tfrc.json"), nil
}

0 comments on commit 937eeb4

Please sign in to comment.