Skip to content
Evergreen Evergreen
Documentation

The list() and map() functions were removed in Terraform 0.15

Removed. The source gives no day. Replacement: tolist([ … ]) for list(), tomap({ … }) for map(). Source: Terraform 0.15 upgrade guide: legacy configuration language features.

Check a version:

evergreen check pkg:generic/terraform

Terraform v0.12 replaced the list() and map() functions with first-class [ … ] and { … } syntax, and the v0.15 upgrade guide states that the deprecated functions were removed in v0.15. Replace list(a, b) with tolist([a, b]) and map(k, v) with tomap({ k = v }); because Terraform can usually infer the type from context, the bare [ … ] and { … } forms often work without the conversion. The list(string) and map(string) type constraints are different and remain valid.

Look up another package or runtime · <form action="../lookup.html" method="get" role="search"> </form>

   
Status Removed
Severity high
Ecosystem terraform
Component pkg:generic/terraform
Affected versions vers:semver/>=0.15.0
Date from the source The source gives no day
Replacement tolist([ … ]) for list(), tomap({ … }) for map()
Evidence last seen 2026-10-31
Reviewed 2026-10-31 by arminazimi
Review due 2027-01-29 (90 days after the last review)
Rule ID terraform.function.list-map

Sources

Migration

Constraints

  • Do not rewrite a type constraint: type = list(string) and type = map(object({...})) are type constructors that still exist in Terraform 0.15 and later.
  • Rewrite a call only when every argument is on one line and the argument count is meaningful: list() needs at least one value, and map() needs an even number of key/value arguments.
  • In a map() call, write each key as an identifier or a quoted string; a bare expression key does not have the same meaning in an object constructor.

Steps

  1. Replace the removed calls. Change list(a, b) to tolist([a, b]) and map("k", v) to tomap({ k = v }). When the surrounding context already fixes the type, the bare [a, b] and { k = v } forms are also correct.
  2. Find the calls left in other files. Search *.tf for list( and map( outside variable type constraints, and rewrite the value calls the same way. Leave list(string), map(string), and other type constructors unchanged.

Verification

  • terraform init -backend=false && terraform validate: Initialize without touching remote state and check that no removed function is left.
  • terraform plan: Confirm the collection types and values are unchanged apart from the rewrite.

Detected by

The terraform detector. See Detectors and Compatibility.

Same ecosystem

Data

This page is generated from registry/terraform.json, rule terraform.function.list-map, in the ebb.registry.v2 format (how rules are written). A CLE (ECMA-428) export is not published yet. The same facts are embedded in this page as schema.org structured data.

Last updated