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

# TerraformIterator

> Iterate over collections in Terraform resources.

`TerraformIterator` is used with the `forEach` meta-argument to create multiple instances of a resource or data source.

## Static Methods

### fromList()

```typescript theme={null}
static fromList(list: any[]): TerraformIterator
```

Creates an iterator from a list.

### fromMap()

```typescript theme={null}
static fromMap(map: Record<string, any>): TerraformIterator
```

Creates an iterator from a map.

## Properties

### key

`readonly key: string`
The key of the current element (for maps) or the index (for lists).

### value

`readonly value: any`
The value of the current element.

## Methods

### getString()

```typescript theme={null}
getString(name: string): string
```

Returns a string attribute from the current element.

### getNumber()

```typescript theme={null}
getNumber(name: string): number
```

Returns a number attribute from the current element.

### getBoolean()

```typescript theme={null}
getBoolean(name: string): boolean
```

Returns a boolean attribute from the current element.

### getList()

```typescript theme={null}
getList(name: string): string[]
```

Returns a list attribute from the current element.

### getMap()

```typescript theme={null}
getMap(name: string): Record<string, any>
```

Returns a map attribute from the current element.

***

## TerraformCount

`TerraformCount` is used with the `count` meta-argument.

### index

`readonly index: number`
The current index in the count loop.
