Interview Prep/Terraform/Variables, Locals, Outputs and Types

How does Terraform convert between types automatically?

AdvancedConceptVariables, Locals, Outputs and Types
Answer

Primitive conversions are implicit (number to string and back, bool to string). Collections convert if element types convert, so a list of numbers can be passed where list(string) is expected. Tuples and objects convert to lists and maps when elements share a type. Use explicit functions (tostring, tonumber, tolist, toset, tomap) to make intent clear.

All Terraform questions Roadmap: Terraform

More on Variables, Locals, Outputs and Types