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