Using complex input variables (list of objects) with Spacelift templates

Last updated: October 29, 2026

Spacelift templates currently do not have a dedicated input type for complex variables such as list(object({})). However, there is a workaround you can use in the meantime.

Workaround: Using the TF_VAR_ trick with JSON

You can pass a complex variable as a plain string input using the TF_VAR_ environment variable convention, providing the value as a JSON-encoded object or array.

For example, instead of defining a native list(object) input, you would set an environment variable like:

TF_VAR_stacks=[{"name":"some-stack","branch":"main"},{"name":"another-stack","branch":"develop"}]

Terraform will automatically parse this JSON string and map it to the corresponding variable in your module.

See Hashi's documentation for TF_VAR_name here.

Request native support for complex input types

If native support for complex input types in Spacelift templates is important to you, please upvote the following feature request on the Spacelift feedback portal. This helps the product team gauge demand and prioritize accordingly.