Skip to content

Commit

Permalink
Merge pull request #20675 from hashicorp/f-file-function-recommendation
Browse files Browse the repository at this point in the history
config: Mention other file hashing functions when file() detects unsupported contents
  • Loading branch information
bflad authored Mar 14, 2019
2 parents 6c346b5 + 398fe86 commit 87f1877
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lang/funcs/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func MakeFileFunc(baseDir string, encBase64 bool) function.Function {
return cty.StringVal(enc), nil
default:
if !utf8.Valid(src) {
return cty.UnknownVal(cty.String), fmt.Errorf("contents of %s are not valid UTF-8; to read arbitrary bytes, use the filebase64 function instead", path)
return cty.UnknownVal(cty.String), fmt.Errorf("contents of %s are not valid UTF-8; use the filebase64 function to obtain the Base64 encoded contents or the other file functions (e.g. filemd5, filesha256) to obtain file hashing results instead", path)
}
return cty.StringVal(string(src)), nil
}
Expand Down

0 comments on commit 87f1877

Please sign in to comment.