We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 19d6fdf commit a641162Copy full SHA for a641162
1 file changed
config/interpolate_funcs.go
@@ -9,6 +9,7 @@ import (
9
"strings"
10
11
"github.com/hashicorp/terraform/config/lang/ast"
12
+ "github.com/mitchellh/go-homedir"
13
)
14
15
// Funcs is the mapping of built-in functions for configuration.
@@ -57,7 +58,12 @@ func interpolationFuncFile() ast.Function {
57
58
ArgTypes: []ast.Type{ast.TypeString},
59
ReturnType: ast.TypeString,
60
Callback: func(args []interface{}) (interface{}, error) {
- data, err := ioutil.ReadFile(args[0].(string))
61
+ var path string
62
+ path, err := homedir.Expand(args[0].(string))
63
+ if err != nil {
64
+ return "", err
65
+ }
66
+ data, err := ioutil.ReadFile(path)
67
if err != nil {
68
return "", err
69
}
0 commit comments