# Terraform Type Constraints (Collection & Structural)

### Type Constraints - Terraform Variables

* Type constraints control the type of variable values
* Primitive (Single type value)
  * number, string, bool
* Complex (Multiple types in a single variable)
  * list, tuple, map, object

### Complex types - Collections

* Collection types allow multiple values of one primitive types to be grouped together.
* Constructors of these Collections include:
  * list(type)
  * map(type)
  * set(type)

<figure><img src="/files/hBk261rINW1I80mO3249" alt=""><figcaption></figcaption></figure>

### Complex types - Structural

* Structural types allow multiple values of different primitive types to be grouped together
* Constructors of these Collections include:
  * object(type)
  * tuple(type)
  * set(type)

<figure><img src="/files/B4KjdOqrv8aXD44ltNDi" alt=""><figcaption></figcaption></figure>

### Dynamic types - The "any" constraint

* **Any** is a placeholder for primitive type yet to be decided
* Actual type will be determined at runtime

<figure><img src="/files/zwOKJk4J22Y5VQjLrUDS" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://huy312100.gitbook.io/software-development/devops/iac/terraform/built-in-functions-and-dynamic-blocks/terraform-type-constraints-collection-and-structural.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
