github.com/jaredpalmer/terraform@v1.1.0-alpha20210908.0.20210911170307-88705c943a03/website/docs/language/functions/distinct.html.md (about) 1 --- 2 layout: "language" 3 page_title: "distinct - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-collection-distinct" 5 description: |- 6 The distinct function removes duplicate elements from a list. 7 --- 8 9 # `distinct` Function 10 11 `distinct` takes a list and returns a new list with any duplicate elements 12 removed. 13 14 The first occurrence of each value is retained and the relative ordering of 15 these elements is preserved. 16 17 ## Examples 18 19 ``` 20 > distinct(["a", "b", "a", "c", "d", "b"]) 21 [ 22 "a", 23 "b", 24 "c", 25 "d", 26 ] 27 ```