- Functions
- tostring
tostring
Function
tostring
converts its argument to a string value.
Explicit type conversions are rarely necessary in OpenTofu because it will convert types automatically where required. Use the explicit type conversion functions only to normalize types returned in module outputs.
Only the primitive types (string, number, and bool) and null
can be converted to string.
tostring(null)
produces a null
value of type string
. All other values produce an error.