Merge pull request #28334 from paultyng/patch-1

Add null to type conversion docs
This commit is contained in:
Laura Pacilio 2021-09-02 14:47:38 -04:00 committed by GitHub
commit 73a3bb2702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View File

@ -14,7 +14,7 @@ Explicit type conversions are rarely necessary in Terraform because it will
convert types automatically where required. Use the explicit type conversion
functions only to normalize types returned in module outputs.
Only boolean values and the exact strings `"true"` and `"false"` can be
Only boolean values, `null`, and the exact strings `"true"` and `"false"` can be
converted to boolean. All other values will produce an error.
## Examples
@ -24,6 +24,8 @@ converted to boolean. All other values will produce an error.
true
> tobool("true")
true
> tobool(null)
null
> tobool("no")
Error: Invalid function argument

View File

@ -14,7 +14,7 @@ Explicit type conversions are rarely necessary in Terraform because it will
convert types automatically where required. Use the explicit type conversion
functions only to normalize types returned in module outputs.
Only numbers and strings containing decimal representations of numbers can be
Only numbers, `null`, and strings containing decimal representations of numbers can be
converted to number. All other values will produce an error.
## Examples
@ -24,6 +24,8 @@ converted to number. All other values will produce an error.
1
> tonumber("1")
1
> tonumber(null)
null
> tonumber("no")
Error: Invalid function argument

View File

@ -14,7 +14,7 @@ Explicit type conversions are rarely necessary in Terraform 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) can be converted to string.
Only the primitive types (string, number, and bool) and `null` can be converted to string.
All other values will produce an error.
## Examples
@ -26,6 +26,8 @@ hello
1
> tostring(true)
true
> tostring(null)
null
> tostring([])
Error: Invalid function argument