# atmos terraform taint

Use this command to mark a Terraform resource for recreation in an Atmos component's next apply operation. Note: This command is deprecated in Terraform v1.0+.

## Usage

Execute the `terraform taint` command like this:

```shell
atmos terraform taint <component> -s <stack> [options]
```

This command marks a resource as tainted in the Terraform state. Tainted resources will be destroyed and recreated on the next apply. Note: This command is deprecated in Terraform v1.0+ in favor of `terraform apply -replace`.

:::info Atmos Behavior
Atmos provides standard setup for this command including automatic `terraform init`, workspace selection, and variable file generation. Additionally, Atmos blocks this operation if the component is locked (`metadata.locked: true`). The taint operation itself is handled by native Terraform.
:::

## Examples

### Taint a Resource

```shell
# Mark a resource as tainted
atmos terraform taint vpc -s dev aws_instance.web
```

### Taint with Module Path

```shell
# Taint a resource in a module
atmos terraform taint app -s dev module.vpc.aws_subnet.private[0]
```

:::note
In Terraform v1.0+, use `terraform apply -replace` instead:

```shell
atmos terraform apply vpc -s dev -replace=aws_instance.web
```

:::

## Arguments

- **`component` (required)**

  Atmos component name.

## Flags

- **`--stack` / `-s` (required)**

  Atmos stack name where the component is defined.
- **`--skip-init` (optional)**

  Skip running `terraform init` before executing the command.
  ```shell
  atmos terraform taint vpc -s dev --skip-init
  ```
- **`--dry-run` (optional)**

  Show what would be executed without actually running the command.
  ```shell
  atmos terraform taint vpc -s dev --dry-run
  ```

## Native Terraform Flags

This command supports native `terraform taint` flags such as `-lock=false` to disable state locking, `-lock-timeout` to override lock timeout.

## Related Commands

- [`atmos terraform plan`](/cli/commands/terraform/plan) - Generate execution plan
- [`atmos terraform apply`](/cli/commands/terraform/apply) - Apply changes
- [`atmos terraform init`](/cli/commands/terraform/init) - Initialize working directory
