> ## Documentation Index
> Fetch the complete documentation index at: https://errand.nuvrel.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# values

> Return the values of a map as a list.

`values(mapping)` returns a list of all values in `mapping`, in the same order as the keys returned by [`keys`](/functions/collection/keys) (sorted lexicographically by key).

## Signature

```
values(mapping map) list
```

## Example

Extract all configured service ports from a map and validate that none are in the reserved range before starting the stack:

```hcl theme={null}
variable "ports" {
  description = "Port assignments per service"
  type        = map(number)
  default = {
    api       = 8080
    metrics   = 9090
    dashboard = 3000
  }
}

computed "port_list" {
  description = "All configured ports"
  expression  = values(var.ports)
}

task "check-ports" {
  description = "Print all configured ports"
  commands = [
    "echo 'Services: ${join(", ", keys(var.ports))}'",
    "echo 'Ports: ${join(", ", [for p in computed.port_list : tostring(p)])}'",
  ]
}
```

`computed.port_list` becomes `[3000, 8080, 9090]` (sorted by key: `dashboard`, `api`, `metrics`).

## Notes

* The order of values corresponds to the lexicographic order of their keys, not the order they were declared.
* `values` also works on objects. When applied to an object, it returns the attribute values as a tuple ordered by lexicographic key order.
* To get keys, use [`keys`](/functions/collection/keys). To look up a specific value by key, use bracket notation or [`lookup`](/functions/collection/lookup).
