You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
terraform/website/docs/language/functions/contains.mdx

31 lines
1.2 KiB

---
page_title: contains - Functions - Configuration Language
description: The contains function determines whether a list or set contains a given value.
---
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
> [!IMPORTANT]
> **Documentation Update:** Product documentation previously located in `/website` has moved to the [`hashicorp/web-unified-docs`](https://github.com/hashicorp/web-unified-docs) repository, where all product documentation is now centralized. Please make contributions directly to `web-unified-docs`, since changes to `/website` in this repository will not appear on developer.hashicorp.com.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
# `contains` Function
`contains` determines whether the list, tuple, or set given in its first
argument contains at least one element that is equal to the value in the second
argument, using the same definition of equality as the `==` operator described in
[Equality Operators](/terraform/language/expressions/operators#equality-operators).
```hcl
contains(list, value)
```
## Examples
```
> contains(["a", "b", "c"], "a")
true
> contains(["a", "b", "c"], "d")
false
```