type Function
Note: This function is available only in Terraform 1.0 and later.
type
returns the type of a given value.
Sometimes a Terraform configuration can result in confusing errors regarding inconsistent types. This function displays terraform's evaluation of a given value's type, which is useful in understanding this error message.
This is a special function which is only available in the terraform console
command. It can only be used to examine the type of a given value, and should
not be used in more complex expressions.
Examples
Here we have a conditional output
which prints either the value of var.list
or a local named default_list
:
Applying this configuration results in the following error:
While this error message does include some type information, it can be helpful
to inspect the exact type that Terraform has determined for each given input.
Examining both var.list
and local.default_list
using the type
function
provides more context for the error message: