aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/hashicorp/terraform/lang/funcs/filesystem.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/lang/funcs/filesystem.go')
-rw-r--r--vendor/github.com/hashicorp/terraform/lang/funcs/filesystem.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/terraform/lang/funcs/filesystem.go b/vendor/github.com/hashicorp/terraform/lang/funcs/filesystem.go
index 7dfc905..016b102 100644
--- a/vendor/github.com/hashicorp/terraform/lang/funcs/filesystem.go
+++ b/vendor/github.com/hashicorp/terraform/lang/funcs/filesystem.go
@@ -237,6 +237,21 @@ var DirnameFunc = function.New(&function.Spec{
237 }, 237 },
238}) 238})
239 239
240// AbsPathFunc constructs a function that converts a filesystem path to an absolute path
241var AbsPathFunc = function.New(&function.Spec{
242 Params: []function.Parameter{
243 {
244 Name: "path",
245 Type: cty.String,
246 },
247 },
248 Type: function.StaticReturnType(cty.String),
249 Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) {
250 absPath, err := filepath.Abs(args[0].AsString())
251 return cty.StringVal(filepath.ToSlash(absPath)), err
252 },
253})
254
240// PathExpandFunc constructs a function that expands a leading ~ character to the current user's home directory. 255// PathExpandFunc constructs a function that expands a leading ~ character to the current user's home directory.
241var PathExpandFunc = function.New(&function.Spec{ 256var PathExpandFunc = function.New(&function.Spec{
242 Params: []function.Parameter{ 257 Params: []function.Parameter{