Lifecycle Meta-Arguments
The lifecycle meta-argument allows you to customize resource lifecycle behavior directly from main.yml or domain configuration files.
1. prevent_destroy
Section titled “1. prevent_destroy”Prevents accidental destruction of critical test cases, plans, or test runs. Following Terraform conventions, lifecycle is declared inside the resource: block:
# main.yml or resource.ymlresource: testcase: match: "features/*.case.feature" lifecycle: prevent_destroy: trueOr directly on individual scenarios via Gherkin tags:
@tc-1 @smoke@prevent_destroyScenario: Critical authenticationWhen active, running testform destroy or generating a plan that marks the resource for destruction will halt execution immediately with an error:
Error: Instance cannot be destroyedResource github_testcase.auth/login.case.feature.@tc-1 has lifecycle.prevent_destroy set.2. ignore_changes
Section titled “2. ignore_changes”Suppresses drift detection for specific volatile attributes (e.g. labels, title, assignees):
# main.yml or resource.ymlresource: testrun: match: "suites/*.run.feature" lifecycle: ignore_changes: - labels - assigneesOr via Gherkin tag:
@tr-1@ignore_changes("labels", "assignees")Scenario: Smoke Suite ExecutionAttributes listed in ignore_changes will be ignored during testform plan, testform diff, and state refresh calculations.