github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/cli/commands/taint.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Command: taint" 4 sidebar_current: "docs-commands-taint" 5 description: |- 6 The `terraform taint` command informs Terraform that a particular object 7 is damaged or degraded. 8 --- 9 10 # Command: taint 11 12 The `terraform taint` command informs Terraform that a particular object has 13 become degraded or damaged. Terraform represents this by marking the 14 object as "tainted" in the Terraform state, in which case Terraform will 15 propose to replace it in the next plan you create. 16 17 ~> *Warning:* This command is deprecated, because there are better alternatives 18 available in Terraform v0.15.2 and later. See below for more details. 19 20 If your intent is to force replacement of a particular object even though 21 there are no configuration changes that would require it, we recommend instead 22 to use the `-replace` option with [`terraform apply`](./apply.html). 23 For example: 24 25 ``` 26 terraform apply -replace="aws_instance.example[0]" 27 ``` 28 29 Creating a plan with the "replace" option is superior to using `terraform taint` 30 because it will allow you to see the full effect of that change before you take 31 any externally-visible action. When you use `terraform taint` to get a similar 32 effect, you risk someone else on your team creating a new plan against your 33 tainted object before you've had a chance to review the consequences of that 34 change yourself. 35 36 The `-replace=...` option to `terraform apply` is only available from 37 Terraform v0.15.2 onwards, so if you are using an earlier version you will need 38 to use `terraform taint` to force object replacement, while considering the 39 caveats described above. 40 41 ## Usage 42 43 Usage: `terraform taint [options] address` 44 45 The `address` argument is the address of the resource to mark as tainted. 46 The address is in 47 [the resource address syntax](/docs/cli/state/resource-addressing.html) syntax, 48 as shown in the output from other commands, such as: 49 50 * `aws_instance.foo` 51 * `aws_instance.bar[1]` 52 * `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) 53 * `module.foo.module.bar.aws_instance.qux` 54 55 This command accepts the following options: 56 57 * `-allow-missing` - If specified, the command will succeed (exit code 0) 58 even if the resource is missing. The command might still return an error 59 for other situations, such as if there is a problem reading or writing 60 the state. 61 62 * `-lock=false` - Disables Terraform's default behavior of attempting to take 63 a read/write lock on the state for the duration of the operation. 64 65 * `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`, 66 instructs Terraform to retry acquiring a lock for a period of time before 67 returning an error. The duration syntax is a number followed by a time 68 unit letter, such as "3s" for three seconds. 69 70 For configurations using 71 [the `remote` backend](/docs/language/settings/backends/remote.html) 72 only, `terraform taint` 73 also accepts the option 74 [`-ignore-remote-version`](/docs/language/settings/backends/remote.html#command-line-arguments). 75 76 For configurations using 77 [the `local` backend](/docs/language/settings/backends/local.html) only, 78 `terraform taint` also accepts the legacy options 79 [`-state`, `-state-out`, and `-backup`](/docs/language/settings/backends/local.html#command-line-arguments).