github.com/eliastor/durgaform@v0.0.0-20220816172711-d0ab2d17673e/website/docs/cli/commands/taint.mdx (about) 1 --- 2 page_title: 'Command: taint' 3 description: |- 4 The `terraform taint` command informs Terraform that a particular object 5 is damaged or degraded. 6 --- 7 8 # Command: taint 9 10 The `terraform taint` command informs Terraform that a particular object has 11 become degraded or damaged. Terraform represents this by marking the 12 object as "tainted" in the Terraform state, and Terraform will 13 propose to replace it in the next plan you create. 14 15 ~> **Warning:** This command is deprecated. For Terraform v0.15.2 and later, we recommend using the `-replace` option with `terraform apply` instead (details below). 16 17 ## Recommended Alternative 18 19 For Terraform v0.15.2 and later, we recommend using the [`-replace` option](/cli/commands/plan#replace-address) with `terraform apply` to force Terraform to replace an object even though there are no configuration changes that would require it. 20 21 ``` 22 $ terraform apply -replace="aws_instance.example[0]" 23 ``` 24 25 We recommend the `-replace` option because the change will be reflected in the Terraform plan, letting you understand how it will affect your infrastructure before you take any externally-visible action. When you use `terraform taint`, other users could create a new plan against your tainted object before you can review the effects. 26 27 ## Usage 28 29 ``` 30 $ terraform taint [options] <address> 31 ``` 32 33 The `address` argument is the address of the resource to mark as tainted. 34 The address is in 35 [the resource address syntax](/cli/state/resource-addressing) syntax, 36 as shown in the output from other commands, such as: 37 38 - `aws_instance.foo` 39 - `aws_instance.bar[1]` 40 - `aws_instance.baz[\"key\"]` (quotes in resource addresses must be escaped on the command line, so that they will not be interpreted by your shell) 41 - `module.foo.module.bar.aws_instance.qux` 42 43 This command accepts the following options: 44 45 - `-allow-missing` - If specified, the command will succeed (exit code 0) 46 even if the resource is missing. The command might still return an error 47 for other situations, such as if there is a problem reading or writing 48 the state. 49 50 - `-lock=false` - Disables Terraform's default behavior of attempting to take 51 a read/write lock on the state for the duration of the operation. 52 53 - `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`, 54 instructs Terraform to retry acquiring a lock for a period of time before 55 returning an error. The duration syntax is a number followed by a time 56 unit letter, such as "3s" for three seconds. 57 58 For configurations using the [Terraform Cloud CLI integration](/cli/cloud) or the [`remote` backend](/language/settings/backends/remote) only, `terraform taint` 59 also accepts the option 60 [`-ignore-remote-version`](/cli/cloud/command-line-arguments#ignore-remote-version). 61 62 For configurations using 63 [the `local` backend](/language/settings/backends/local) only, 64 `terraform taint` also accepts the legacy options 65 [`-state`, `-state-out`, and `-backup`](/language/settings/backends/local#command-line-arguments).