mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-20 11:48:24 -06:00
Merge pull request #20675 from hashicorp/f-file-function-recommendation
config: Mention other file hashing functions when file() detects unsupported contents
This commit is contained in:
commit
87f1877a81
@ -40,7 +40,7 @@ func MakeFileFunc(baseDir string, encBase64 bool) function.Function {
|
|||||||
return cty.StringVal(enc), nil
|
return cty.StringVal(enc), nil
|
||||||
default:
|
default:
|
||||||
if !utf8.Valid(src) {
|
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
|
return cty.StringVal(string(src)), nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user