Skip to content

lifecycle

The lifecycle meta-argument in Testform customizes the default lifecycle management of test resources, protecting them against accidental destruction and suppressing unwanted state drift.


Testform implements two primary controls:

Strictly halts any execution plan attempting to delete or archive critical test specifications during testform destroy or reconciliation plans:

@auth @critical
@prevent_destroy
Scenario: High-value bank fund transfer
Given user has sufficient account balance
When user authorizes transfer with multi-factor authentication
Then transaction receipt is generated

If an operator or pipeline attempts to destroy this scenario:

[ERROR] Cannot destroy resource protected by prevent_destroy:
auth/payment.feature.@transfer_funds
The resource is configured with prevent_destroy = true.

Suppresses drift detection when external edits occur (e.g. labels, assignees, or priority fields modified in issue trackers):

@ignore_changes("labels", "assignees", "priority")
Scenario: User profile inspection
Given user navigates to settings dashboard
Then personal information is displayed

Following Terraform conventions, the lifecycle meta-argument belongs strictly within the resource: block:

# main.yml or resource.yml
resource:
testcase:
match: "features/*.case.feature"
lifecycle:
prevent_destroy: true
ignore_changes:
- labels
- assignees