]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/github.com/hashicorp/terraform/lang/funcs/filesystem.go
update vendor and go.mod
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / terraform / lang / funcs / filesystem.go
index 7dfc9058758b413715383131e7874cbdcd0837de..016b102d946b9e98405188d78236bb623fcf4e56 100644 (file)
@@ -237,6 +237,21 @@ var DirnameFunc = function.New(&function.Spec{
        },
 })
 
+// AbsPathFunc constructs a function that converts a filesystem path to an absolute path
+var AbsPathFunc = function.New(&function.Spec{
+       Params: []function.Parameter{
+               {
+                       Name: "path",
+                       Type: cty.String,
+               },
+       },
+       Type: function.StaticReturnType(cty.String),
+       Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) {
+               absPath, err := filepath.Abs(args[0].AsString())
+               return cty.StringVal(filepath.ToSlash(absPath)), err
+       },
+})
+
 // PathExpandFunc constructs a function that expands a leading ~ character to the current user's home directory.
 var PathExpandFunc = function.New(&function.Spec{
        Params: []function.Parameter{