testform taint
testform [global options] taint [options] <address>The testform taint command manually marks a managed resource instance as tainted in the state file. An instance marked this way is considered corrupted, partially failed, or in need of complete rebuilding.
During the next execution of testform apply, Testform will execute a replacement operation (-/+), destroying the current remote issue/entity and provisioning a fresh one from scratch.
When to Taint a Resource
Section titled “When to Taint a Resource”- The comment stream on a GitHub Issue has become chaotic or corrupted and needs a clean slate.
- A remote test issue was altered out-of-band by an external automation tool.
- Immutable properties were updated that require recreating the entity.
Command Options
Section titled “Command Options”| Option | Default | Description |
|---|---|---|
<address> |
(required) | Canonical address or identity tag of the resource (e.g. "login.case.feature.@tc-1"). |
-allow-missing |
false |
If specified, the command succeeds (exit code 0) even if the resource is missing from state. |
-lock=false |
true |
Do not hold a state lock during the operation. |
-lock-timeout=0s |
0s |
Duration to retry a state lock. |
-state=path |
testform.state |
Path to the state file to use. |
Real Execution Example
Section titled “Real Execution Example”# Mark resource instance as tainted$ testform taint "login.case.feature.@tc-1"Resource instance login.case.feature.@tc-1 has been marked as tainted.
# Run plan to verify planned replacement$ testform planTestform will perform the following actions:
# login.case.feature.@tc-1 is tainted, so must be replaced-/+ resource "testcase" "login_valid" { ~ id = 104 -> (known after apply) }
Plan: 1 to add, 0 to change, 1 to destroy.Reverting Taint with untaint
Section titled “Reverting Taint with untaint”If you marked a resource by mistake, you can revert the action before running apply using the testform untaint command:
$ testform untaint "login.case.feature.@tc-1"Resource instance login.case.feature.@tc-1 has been successfully untainted.Exit Codes
Section titled “Exit Codes”0: Taint status successfully recorded.1: Resource address was not found in the state ledger or failed to acquire state lock.