Skip to content

Commit 937eeb4

Browse files
author
Elie
committed
Fix windows TFCloud creds path
1 parent 8066995 commit 937eeb4

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

pkg/iac/terraform/state/backend/tfcloud_config_reader.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"errors"
66
"io"
77
"io/ioutil"
8+
"os"
89
"path/filepath"
910
"runtime"
1011

@@ -48,9 +49,9 @@ func getTerraformConfigFile() (string, error) {
4849
if err != nil {
4950
return "", err
5051
}
51-
tfConfigDir := ".terraform.d"
52+
basePath := filepath.Join(homeDir, ".terraform.d")
5253
if runtime.GOOS == "windows" {
53-
tfConfigDir = "terraform.d"
54+
basePath = filepath.Join(os.Getenv("APPDATA"), "terraform.d")
5455
}
55-
return filepath.Join(homeDir, tfConfigDir, "credentials.tfrc.json"), nil
56+
return filepath.Join(basePath, "credentials.tfrc.json"), nil
5657
}

0 commit comments

Comments
 (0)