config: Mention other file hashing functions when file() detects unsupported contents

Reference: https://github.com/hashicorp/terraform/issues/20664
This commit is contained in:
Brian Flad 2019-03-13 13:43:58 -04:00
parent 2b726a892f
commit 398fe8652d
No known key found for this signature in database
GPG Key ID: EC6252B42B012823
1 changed files with 1 additions and 1 deletions

View File

@ -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
}