> ## 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.

# TerraformResource

> Base class for all Terraform resources.

`TerraformResource` represents a resource in Terraform.

## TerraformMetaArguments

All resources support the following meta-arguments:

| Property    | Type                         | Description                      |
| :---------- | :--------------------------- | :------------------------------- |
| `dependsOn` | `ITerraformAddressable[]`    | Explicit dependencies.           |
| `count`     | `number \| TerraformCount`   | Resource count.                  |
| `provider`  | `TerraformProvider`          | Specific provider instance.      |
| `lifecycle` | `TerraformResourceLifecycle` | Lifecycle configuration.         |
| `forEach`   | `TerraformIterator`          | Iterator for multiple resources. |

## TerraformResourceLifecycle

| Property              | Type       | Description                                    |
| :-------------------- | :--------- | :--------------------------------------------- |
| `createBeforeDestroy` | `boolean`  | Create new resource before destroying old one. |
| `preventDestroy`      | `boolean`  | Prevent accidental destruction.                |
| `ignoreChanges`       | `string[]` | List of attributes to ignore changes for.      |
| `replaceTriggeredBy`  | `any[]`    | Replace resource when these change.            |

## Methods

### importFrom()

```typescript theme={null}
importFrom(id: string): void
```

Configures the resource to be imported from an existing ID.

### moveTo()

```typescript theme={null}
moveTo(target: string): void
```

Moves the resource to a new address in the state.

### moveToId()

```typescript theme={null}
moveToId(id: string): void
```

Moves the resource to a specific ID.

### moveFromId()

```typescript theme={null}
moveFromId(id: string): void
```

Moves the resource from a specific ID.

### interpolationForAttribute()

```typescript theme={null}
interpolationForAttribute(attr: string): IResolvable
```

Returns an interpolation token for a specific attribute.

### getStringAttribute()

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

Returns a string attribute value.

### getNumberAttribute()

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

Returns a number attribute value.

### getBooleanAttribute()

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

Returns a boolean attribute value.

### getListAttribute()

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

Returns a list attribute value.

### getMapAttribute()

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

Returns a map attribute value.
