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

# TerraformStack

> Represents a single Terraform configuration file (or directory).

`TerraformStack` is a unit of deployment. Each stack synthesizes into its own Terraform configuration.

## Constructor

```typescript theme={null}
new TerraformStack(scope: Construct, id: string)
```

## Properties

### kind

`readonly kind: string`
The kind of stack.

### dependencies

`readonly dependencies: TerraformStack[]`
List of stacks that this stack depends on.

### stackName

`readonly stackName: string`
The name of the stack.

## Methods

### static of()

```typescript theme={null}
static of(construct: IConstruct): TerraformStack
```

Returns the `TerraformStack` instance that contains the given construct.

### getLogicalId()

```typescript theme={null}
getLogicalId(element: any): string
```

Returns the logical ID for a given element within the stack.

### prepareStack()

```typescript theme={null}
prepareStack(): void
```

Performs preparation steps before synthesis.

### synthesize()

```typescript theme={null}
synthesize(): void
```

Synthesizes the stack into a Terraform configuration.

### toTerraform()

```typescript theme={null}
toTerraform(): any
```

Returns the Terraform JSON representation of the stack.

### addDependency()

```typescript theme={null}
addDependency(stack: TerraformStack): void
```

Adds a dependency on another stack.

### dependsOn()

```typescript theme={null}
dependsOn(stack: TerraformStack): boolean
```

Checks if this stack depends on another stack.

### ensureBackendExists()

```typescript theme={null}
ensureBackendExists(): TerraformBackend
```

Ensures that a backend is defined for the stack.

### allProviders()

```typescript theme={null}
allProviders(): TerraformProvider[]
```

Returns all providers defined in the stack.
