We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e5f5e1a commit 06eb388Copy full SHA for 06eb388
1 file changed
builtin/providers/template/resource.go
@@ -5,6 +5,8 @@ import (
5
"encoding/hex"
6
"fmt"
7
"io/ioutil"
8
+ "os"
9
+ "path/filepath"
10
11
"github.com/hashicorp/terraform/config"
12
"github.com/hashicorp/terraform/config/lang"
@@ -26,6 +28,18 @@ func resource() *schema.Resource {
26
28
Required: true,
27
29
Description: "file to read template from",
30
ForceNew: true,
31
+ // Make a "best effort" attempt to relativize the file path.
32
+ StateFunc: func(v interface{}) string {
33
+ pwd, err := os.Getwd()
34
+ if err != nil {
35
+ return v.(string)
36
+ }
37
+ rel, err := filepath.Rel(pwd, v.(string))
38
39
40
41
+ return rel
42
+ },
43
},
44
"vars": &schema.Schema{
45
Type: schema.TypeMap,
0 commit comments