github.com/hugorut/terraform@v1.1.3/website/docs/cli/commands/untaint.mdx (about)

     1  ---
     2  page_title: 'Command: untaint'
     3  description: |-
     4    The `terraform untaint` command tells Terraform that an object is functioning
     5    correctly, even though its creation failed or it was previously manually
     6    marked as degraded.
     7  ---
     8  
     9  # Command: untaint
    10  
    11  Terraform has a marker called "tainted" which it uses to track that an object
    12  might be damaged and so a future Terraform plan ought to replace it.
    13  
    14  Terraform automatically marks an object as "tainted" if an error occurs during
    15  a multi-step "create" action, because Terraform can't be sure that the object
    16  was left in a fully-functional state.
    17  
    18  You can also manually mark an object as "tainted" using the deprecated command
    19  [`terraform taint`](/cli/commands/taint), although we no longer recommend that
    20  workflow.
    21  
    22  If Terraform currently considers a particular object as tainted but you've
    23  determined that it's actually functioning correctly and need _not_ be replaced,
    24  you can use `terraform untaint` to remove the taint marker from that object.
    25  
    26  This command _will not_ modify any real remote objects, but will modify the
    27  state in order to remove the tainted status.
    28  
    29  If you remove the taint marker from an object but then later discover that it
    30  was degraded after all, you can create and apply a plan to replace it without
    31  first re-tainting the object, by using a command like the following:
    32  
    33  ```
    34  terraform apply -replace="aws_instance.example[0]"
    35  ```
    36  
    37  ## Usage
    38  
    39  Usage: `terraform untaint [options] address`
    40  
    41  The `address` argument is a [resource address](/cli/state/resource-addressing)
    42  identifying a particular resource instance which is currently tainted.
    43  
    44  This command also accepts the following options:
    45  
    46  * `-allow-missing` - If specified, the command will succeed (exit code 0)
    47    even if the resource is missing. The command might still return an error
    48    for other situations, such as if there is a problem reading or writing
    49    the state.
    50  
    51  * `-lock=false` - Don't hold a state lock during the operation. This is
    52    dangerous if others might concurrently run commands against the same
    53    workspace.
    54  
    55  * `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`,
    56    instructs Terraform to retry acquiring a lock for a period of time before
    57    returning an error. The duration syntax is a number followed by a time
    58    unit letter, such as "3s" for three seconds.
    59  
    60  * `-no-color` - Disables terminal formatting sequences in the output. Use this
    61    if you are running Terraform in a context where its output will be
    62    rendered by a system that cannot interpret terminal formatting.
    63  
    64  For configurations using
    65  [the `remote` backend](/language/settings/backends/remote)
    66  only, `terraform untaint`
    67  also accepts the option
    68  [`-ignore-remote-version`](/language/settings/backends/remote#command-line-arguments).
    69  
    70  For configurations using
    71  [the `local` backend](/language/settings/backends/local) only,
    72  `terraform untaint` also accepts the legacy options
    73  [`-state`, `-state-out`, and `-backup`](/language/settings/backends/local#command-line-arguments).