github.com/hs0210/hashicorp-terraform@v0.11.12-beta1/website/docs/commands/untaint.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "Command: untaint" 4 sidebar_current: "docs-commands-untaint" 5 description: |- 6 The `terraform untaint` command manually unmarks a Terraform-managed resource as tainted, restoring it as the primary instance in the state. 7 --- 8 9 # Command: untaint 10 11 The `terraform untaint` command manually unmarks a Terraform-managed resource 12 as tainted, restoring it as the primary instance in the state. This reverses 13 either a manual `terraform taint` or the result of provisioners failing on a 14 resource. 15 16 This command _will not_ modify infrastructure, but does modify the state file 17 in order to unmark a resource as tainted. 18 19 ~> **NOTE on Tainted Indexes:** In certain edge cases, more than one tainted 20 instance can be present for a single resource. When this happens, the `-index` 21 flag is required to select which of the tainted instances to restore as 22 primary. You can use the `terraform show` command to inspect the state and 23 determine which index holds the instance you'd like to restore. In the vast 24 majority of cases, there will only be one tainted instance, and the `-index` 25 flag can be omitted. 26 27 ## Usage 28 29 Usage: `terraform untaint [options] name` 30 31 The `name` argument is the name of the resource to mark as untainted. The 32 format of this argument is `TYPE.NAME`, such as `aws_instance.foo`. 33 34 The command-line flags are all optional (with the exception of `-index` in 35 certain cases, see above note). The list of available flags are: 36 37 * `-allow-missing` - If specified, the command will succeed (exit code 0) 38 even if the resource is missing. The command can still error, but only 39 in critically erroneous cases. 40 41 * `-backup=path` - Path to the backup file. Defaults to `-state-out` with 42 the ".backup" extension. Disabled by setting to "-". 43 44 * `-index=n` - Selects a single tainted instance when there are more than one 45 tainted instances present in the state for a given resource. This flag is 46 required when multiple tainted instances are present. The vast majority of the 47 time, there is a maximum of one tainted instance per resource, so this flag 48 can be safely omitted. 49 50 * `-lock=true` - Lock the state file when locking is supported. 51 52 * `-lock-timeout=0s` - Duration to retry a state lock. 53 54 * `-module=path` - The module path where the resource to untaint exists. 55 By default this is the root path. Other modules can be specified by 56 a period-separated list. Example: "foo" would reference the module 57 "foo" but "foo.bar" would reference the "bar" module in the "foo" 58 module. 59 60 * `-no-color` - Disables output with coloring 61 62 * `-state=path` - Path to read and write the state file to. Defaults to "terraform.tfstate". 63 Ignored when [remote state](/docs/state/remote.html) is used. 64 65 * `-state-out=path` - Path to write updated state file. By default, the 66 `-state` path will be used. Ignored when 67 [remote state](/docs/state/remote.html) is used.