Measure Initialization, Refresh, Planning and Apply Separately
At 09:10 on a Monday, a plan that usually finishes in four minutes is still running thirteen minutes later. The root manages 1,800 resources across six providers, and someone suggests -parallelism=30. It is a reasonable guess and a bad first move, because "the plan is slow" does not name a phase. Terraform does four kinds of work, and only one is usually the culprit. These are composite numbers, not a benchmark.
Think of an airport departure: check-in, document check, security and boarding all add to the elapsed time. Adding security lanes cannot help if check-in has one desk.
Initialization loads the root module, installs providers and modules, reads the backend configuration and prepares the working directory. It is normally seconds; a cold plugin cache, slow registry, large module tree or distant backend can turn it into minutes. terraform init does not read managed objects, so a slow init is not a resource-count problem.
Refresh is the read pass. For every instance in state, Terraform asks the provider to read the remote object and return its current attributes. It scales with resource count and API latency, and is often the largest part of a slow plan: 1,800 instances means 1,800 provider calls, subject to pagination, retries and limits.
Planning compares configuration with refreshed state, evaluates expressions, resolves data sources where possible and asks providers to plan changes. It can be fast even for a large state unless reads are deferred, provider plan functions are slow or many values stay unknown.
Apply performs writes, waits for provider operations and persists state. Its failure modes are different: rate limits, eventual consistency, long-running creates and lock contention.
| Phase | Main work | Record | Frequent cause of a long phase |
|---|---|---|---|
init | Provider and module installation, backend setup | Seconds, provider count, cache hit | Cold cache, registry latency, large module tree |
| Refresh | One read per managed instance | Instance count, API latency, retries | Serialized graph, throttling, slow reads |
| Plan | Diff, expression evaluation, data reads, plan RPCs | Change count, unknown values, deferred reads | Data-read deferral, provider plan calls |
| Apply | Writes, waits, state persistence | Write count, retries, lock wait | Rate limits, eventual consistency, lock contention |
A duration without context is not evidence
Record the conditions beside the number. CLI and provider versions, OS and architecture, backend type, workspace, region, sanitized state serial and lineage, resource count, variable files and module sources. Then note whether the cache was warm, another CI job was planning the same state, and the provider status page was green.
Time each command as a separate process with wall-clock measurement. The refresh-only run estimates the read pass; the normal plan that follows still starts from the old state snapshot, because a plan does not persist refresh results. Treat the split as an estimate, cross-check it against the timestamps inside one run, and do not loop it: each repetition is another read pass. Time apply from a reviewed saved plan in a disposable environment.
Count instances with terraform state list | wc -l and read the plan summary for changes. Provider timings come from log timestamps: the gap between a reading line and its completion is the call, and a long gap with no new resource line is often one slow request or a retry loop.
A rough floor for wall time is the longer of the critical path and total provider work divided by parallelism. If 1,800 reads average 300 ms and parallelism is 10, the work floor is about 54 seconds. A nine-minute refresh is not explained by that arithmetic, so look for serialization, retries or a much slower read.
Figure 1 separates the phases and the question each answers. Figure 2 places them on one wall-clock timeline and shows which boundary owns each measurement.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
A["Plan takes 13m30s
1,800 resources, 6 providers"] --> B["1. init
install, backend, modules"]
B --> C["2. refresh
one read per managed instance"]
C --> D["3. plan
diff, data reads, plan RPCs"]
D --> E["4. apply
writes, waits, state"]
B --> B1["Record: seconds, cache hit,
provider and module count"]
C --> C1["Record: instance count,
API latency, retries"]
D --> D1["Record: changes, unknowns,
deferred reads"]
E --> E1["Record: writes, waits,
retries, lock wait"]
B1 --> F{"Which phase
owns the time?"}
C1 --> F
D1 --> F
E1 --> F
F -->|"init"| G["Warm cache or mirror"]
F -->|"refresh"| H["Remove broad edges,
check API limits"]
F -->|"plan"| I["Fix data deferral,
provider plan calls"]
F -->|"apply"| J["Backoff, waiters,
serialize writers"]
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class A,F primary;
class B,C,D,E secondary;
class B1,C1,D1,E1 warn;
class G,H,I,J ok;
Figure 2 is the evidence view: a single elapsed time decomposed into phases, with the Core, provider-plugin and remote-API boundaries called out. The point is not the exact numbers; it is that the bar has segments and the segments have owners.
Once the phase is known, the next question is what the provider actually did. That is a log question, and logs are dangerous.
Use Logs as Sensitive Diagnostic Artifacts
A trace log is a transcript
Transcripts contain more than the error. Depending on the provider and level, TF_LOG output can include HTTP bodies, headers, tokens, state attributes, resource identifiers, file paths, user data and the values Terraform was comparing. The file that explains a timeout can also contain a credential.
Terraform layers the detail, and each control narrows the blast radius. TF_LOG sets the global level; the Core and provider controls split it; the path control decides whether the transcript survives the terminal.
| Control | Sets | Use it when |
|---|---|---|
TF_LOG | Global level: TRACE, DEBUG, INFO, WARN, ERROR or off | One pass, before you know which layer is slow |
TF_LOG_CORE | Core only | Scheduling, graph or expression questions, without provider noise |
TF_LOG_PROVIDER | Provider plugins only | RPC and retry questions, without a 500 MB Core trace |
TF_LOG_PATH | A file instead of stderr; requires TF_LOG | The run must outlive the terminal |
TF_LOG=JSON | Trace-level JSON | Never parse it; the format is not a stable interface |
Location is the first control. Write the log under diagnostics/, add that directory to .gitignore, restrict permissions and keep it out of shared temporary directories. A log in the repository root is one broad commit from publication. In CI, use the ephemeral workspace and upload only a redacted excerpt.
Redaction is the second control. Replace account IDs, subscription IDs, project IDs, ARNs, resource names, IPs, hostnames, email addresses and token-shaped strings with consistent placeholders such as ACCOUNT_A and SUBNET_A. Keep the resource type, error code, timestamp and duration: that is the diagnostic signal. Redact before the file leaves the machine, and have a second reader check the excerpt.
Deleting the file does not revoke the credential
Retention is the third control. Delete the trace when the investigation closes. If it must be retained, encrypt it, restrict access, set a short expiry and record why it exists. TF_LOG_PATH appends across runs, so one file can accumulate days of activity. If a live credential appears, rotate it; deleting the file does not revoke it, and crash.log deserves the same handling.
Provider logging is not uniform. Some providers log HTTP at DEBUG, others need trace level, and redaction varies. Assume the least: set TF_LOG_PROVIDER=DEBUG with Core at INFO, reproduce one command, and widen only if the error is still opaque.
The commands below collect the evidence set: counts, graph files and one logged pass. The logged pass writes to diagnostics/tf-trace.log with owner-only permissions.
Each timed command is a separate process, so the numbers include CLI startup and provider handshake. The logged pass runs one normal plan so the trace includes refresh and plan RPCs; it is a diagnostic run, not a plan to apply. If the trace is still large, narrow Core with TF_LOG_CORE=INFO rather than dropping the provider reads.
Figure 3 shows the branch that matters most: a log with a credential is not a log to redact later, it is an incident to contain.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
A["A provider error or a slow call"] --> B{"Need more detail?"}
B -->|"core scheduling"| C["TF_LOG_CORE=DEBUG"]
B -->|"provider RPC"| D["TF_LOG_PROVIDER=DEBUG"]
C --> E["TF_LOG_PATH=diagnostics/tf-trace.log"]
D --> E
E --> F["Run one command
with -no-color"]
F --> G{"Log contains credentials
or state values?"}
G -->|"yes"| H["Quarantine the file
rotate any live credential"]
G -->|"no"| I["Replace account IDs, ARNs,
IPs and names"]
H --> J["Delete after rotation
do not attach"]
I --> K["Keep a short excerpt
with timestamps and a TTL"]
K --> L["Attach to a minimal
reproduction"]
J --> M["Record the incident only"]
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class B,G primary;
class A,C,D,E,F secondary;
class I,K,L ok;
class H,J danger;
class M warn;
The safe sequence is reproduce, capture, inspect, redact, excerpt, delete. The unsafe sequence is reproduce, attach, hope.
Inspect the Dependency Graph for Serialization
Terraform's graph is a claim about what can run at the same time. Nodes are resources, data sources and provider configurations; edges are dependencies. Terraform walks the graph depth-first and starts a node when its dependencies finish, up to the parallelism limit. A wide graph uses the limit; a narrow chain uses one worker no matter how high it is.
terraform graph prints DOT. The default is a simplified resource-and-data ordering graph; the type flags select a different operation, and cycle highlighting requires a real graph type. The evidence widget above writes the plan graph and renders it.
Read for four shapes. Each one names a different cause and a different first move.
| Shape | What it means | First move |
|---|---|---|
| Long chain | Every edge is a wait; one worker does the work | Remove an unnecessary dependency or pass the value |
| Dense cluster around one module | Broad module-level edges | Replace the module argument with an output reference |
| Data node fed by a managed resource | The read is deferred to apply | Remove the dependency or split the root |
| Provider node with hundreds of outgoing edges | Provider configuration is a serial gate | Configure once before resources proceed |
depends_on is the usual source. It exists for dependencies Terraform cannot see, such as an IAM policy that must propagate before a role is used. At resource level it adds one edge. At module level it is broad: every resource in the module depends on every resource in the target, even when one output is consumed.
Pass the value, not the module
A reference creates the edge you need; a module-level argument creates all of them. Use subnet_id = module.network.subnet_id instead of depends_on = [module.network]. If the only reason for the edge is one value, pass the value.
Data-read deferral is subtler. A data source normally reads during refresh or plan. If it depends on a resource that is not yet created, or has an explicit depends_on, Terraform cannot read it until apply. Its result is unknown, every expression that uses it becomes unknown, and apply must read before continuing. The plan looks fast because the read moved; apply looks slow because it landed there. Remove the dependency when the data reads pre-existing infrastructure, or split the root when the data belongs to another lifecycle.
Broad module edges also slow destroy. Dependents must go before dependencies, so a parallel teardown becomes a queue. The same edge can hide a missing output contract. If the only reason for the edge is one value, pass the value.
Figure 4 shows a graph where module-level depends_on edges and a deferred data read turn a wide configuration into a four-stage chain.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
A["Root module"] --> B["module.network"]
B -->|"module-level depends_on"| C["module.cluster"]
C -->|"module-level depends_on"| D["module.services"]
D --> E["data.aws_subnets.shared
read deferred to apply"]
E --> F["aws_lb.app"]
F --> G["aws_instance.app[0..9]"]
B --> H["Genuine reference:
subnet_id"]
H --> F
I["Unnecessary edge:
all services wait for all network"] -.-> C
G --> J["Apply: 10 reads then 10 writes"]
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class D primary;
class A,B,C,E,F,G secondary;
class H ok;
class I warn;
class J warn;
After removing an edge, re-run the graph and the plan, and compare the node count, edge count and wall time. A graph that looks simpler but plans more changes is not an improvement.
Tune Parallelism Within Provider and API Limits
Parallelism is a ceiling, not a goal. Terraform's default is 10 concurrent graph nodes for plan, apply and destroy; -parallelism=n changes it. The docs call this advanced because the graph is only one of four limits.
Throughput. The provider and API process a certain number of calls per second. If the graph has 40 independent reads and the API handles 20 concurrent calls, raising parallelism from 10 to 20 may help; raising it to 40 usually does not, because the extra workers wait in the same queue. The limit may be per account, region, resource type or connection, and it changes with the time of day.
A lower parallelism can be faster
A throttled API makes extra workers wait in the same queue. Providers retry with backoff, so the symptom is a plan longer than the arithmetic suggests, not a failure. Adding workers increases pressure and retry volume. If the limit is a quota, the fix is a quota increase or a smaller blast radius, not a flag.
Eventual consistency. A create can return before the object is readable. The next read may see a 404 or a stale value. More concurrency increases in-flight objects and the chance that a read races a write. Terraform cannot fix this with parallelism; the provider needs a waiter or the configuration needs a real dependency. A sleep is a guess, not synchronization.
Lock contention. State locking allows one writer per state. A plan takes a lock, an apply holds it longer, and a second CI job waits or fails. The symptom is a pause before resource work, not a slow graph. -lock-timeout controls the wait; -lock=false removes protection and is not a performance fix. If waits are common, serialize the pipeline or split the state.
Measure before changing the number. Pick a baseline, change one variable, run three times, take the median and record provider errors alongside duration. Keep the same CLI, provider, state serial, variables and time window. Change one thing: remove a broad edge, split a root, warm the cache or adjust parallelism. If the median does not improve, roll back; the rollback is part of the experiment.
Segmentation is the durable lever. Splitting a root by ownership or lifecycle reduces the resources refreshed in one plan, the blast radius and the teams waiting on one lock. A module split inside the same root does not reduce the graph; it only organizes code. If 1,800 resources are refreshed every time, the answer may be three roots of 600, not 30 workers on 1,800.
Order the levers from cheapest to most structural. Measure the phase, remove unnecessary edges and deferred reads, split the root if the lifecycle allows, warm or mirror the cache, and only then adjust parallelism. Record the old value and the restore command beside every change.
Targeting and Skipped Refresh Are Exceptional Tools
-target and -refresh=false are borrowings against correctness. They can be right in an incident and are wrong as the default for a slow plan.
Targeting is recovery, not routine operation. -target=ADDRESS limits planning to the selected instances and their dependencies. Terraform's docs call it exceptional, for recovery or working around limitations. Unselected resources are not refreshed or planned, so drift outside the target is invisible and a later full plan can reveal changes the targeted apply never considered. Targeting also pulls in dependencies, enlarging the selected set. Follow with a full plan and record why the target was necessary.
Skipped refresh trades accuracy for speed. -refresh=false compares configuration with the last known state, not reality. It can be faster and wrong: an external change, deleted resource, rotated attribute or provider default will not appear. Applying it can fail, overwrite a change or create a duplicate. It is not drift detection, and it is dangerous during a provider upgrade, when refresh may migrate schema state. Use it only when the API is unavailable, with a named owner accepting the risk and a full plan once the API returns.
Selective refresh has a narrower blind spot. -minimal-refresh, added in Terraform 1.17.0, refreshes only instances Terraform plans to change; unchanged resources keep prior state. It cuts API calls on large, stable configurations but still ignores external changes elsewhere. It cannot combine with skipped refresh or refresh-only mode, should not be used during provider upgrades, and does not exist before 1.17, so a runbook that depends on it needs a version gate.
Refresh-only is a reconciliation mode, not a speed setting. -refresh-only plans to update state and outputs to match remote objects. It is legitimate after an intentional console change and costs a full refresh. It does not change configuration.
Figure 5 contrasts the shortcut path with the segmented path. The shortcut produces a fast plan and a later surprise; the segmented path produces a smaller, repeatable plan with a known owner.
Every exceptional flag needs four things: an owner, a reason, an expiry and a follow-up full plan. If the flag becomes routine, the team has made a design decision without admitting it. The durable alternatives are smaller roots, narrower dependencies and a provider cache, not a permanently targeted pipeline.
Write a Reproducible Provider Diagnostic
A provider diagnostic is a sanitized package that lets someone reproduce the behavior without your account, state or credentials, not a transcript dump. The structure: summary and impact, environment, minimal configuration, steps, expected versus actual, evidence, workaround and rollback.
Start with versions, not adjectives. terraform version -json gives the CLI, platform and provider selections; .terraform.lock.hcl gives exact provider versions and hashes. Record backend type, workspace, region, module source references and the date. "Latest" is not a version; "Terraform 1.17" and "AWS provider 6.x" cannot be reproduced six weeks later.
Then reduce. Remove every resource not needed to trigger the behavior. Keep the failing resource and the smallest dependency chain; use synthetic names and, where possible, a provider that needs no credentials. For a provider problem, one resource with the smallest valid arguments is enough. For Core, terraform_data or the local provider may reproduce it without a cloud account. The minimal configuration is also the test: if removing a module makes the behavior disappear, the module edge was part of the cause.
State expected and actual in the same units. "Expected: no changes in under 60 seconds. Actual: 9m12s, exit code 0, 1,802 reads, 37 retry lines." Include the command and timestamp; a screenshot is not a substitute.
Sanitize consistently. Replace account IDs, subscription IDs, ARNs, IPs and names with placeholders such as ACCOUNT_A and RESOURCE_A; use documentation ranges for IPs. Keep resource types, counts, error codes, durations and graph shape. Remove state, plans and full traces; crop the log to 20 or 30 lines around the failure, keep timestamps, scan for token patterns and have a second person read it.
Triage by signal. A provider RPC returning 429, 5xx, a throttling error or a malformed response is usually provider or API. A graph cycle, panic or Core inconsistency is usually Terraform. A 401 or 403 is environment. An unknown value that should be known is configuration or dependency. The category decides where the report goes and which version to test next.
Package the evidence, not the estate. The report should contain a versions file, timings, a graph file, a plan summary and a short trace excerpt — never state, a saved plan or the raw trace. Search both issue trackers for the error text before opening a new report.
The lab below is a mechanics exercise, not a benchmark. It uses the local provider so it costs nothing; the timings will be too fast to show API saturation, but the graph, the phase split and the evidence package are the same.
Investigate a slow plan
Execution status: design-only. This is a mechanics exercise with the local provider; no cloud account is used and no timing here is a provider benchmark.
Prerequisites. Terraform 1.17.1, hashicorp/local 2.9.1 and jq; Graphviz is optional. Use a POSIX shell and allow about 45 minutes. Record your own versions if they differ.
Setup.
- Create a
diagnostics-lab/root with a versions file pinning Terraform 1.17.1 and the local provider 2.9.1. - Add a
main.tfwith 40local_fileresources, driven byfor_each = toset([for i in range(40) : format("item-%02d", i)]). - Give each file
filename = "${path.module}/${each.key}.txt"andcontent = each.key. - Keep the first run free of modules and data sources.
- Run
terraform initand record the wall time, the provider count and whether the plugin cache was warm. - Run
terraform apply -auto-approve; confirm withterraform state list | wc -lthat 40 instances exist and withls *.txt | wc -lthat 40 files exist. - Run
terraform plan -refresh-only,terraform plan, andterraform plan -refresh=falsethree times each. Record the median for each. Expect fast runs because the local provider has no network latency; the exercise is the shape of the evidence, not the size of the numbers. - Run
terraform graph -type=plan > graph-plan.dotand count edges withgrep -c -- '->' graph-plan.dot. Identify the longest path. With 40 independent files, the graph should be wide and shallow. - Add a
terraform_datachain of ten instances, each depending on the previous one. Re-run the graph and the plan. Expect more edges and a longer wall time, though the resource count barely changes. - In a copy, wrap the 40 files in
module.storage, then call a second modulemodule.appwithdepends_on = [module.storage]. Compare edge counts, then replace the module-level argument with an output reference frommodule.storageand compare again. - Run the 40-file plan with
-parallelism=1,-parallelism=5and-parallelism=10. Record the medians. The local provider is too fast to show API saturation; treat this as a scheduling check, not a throughput result. - Write
diagnostics.md: versions, resource count, the three timings, the graph edge counts, the one change you would propose, and the exact rollback command. Add a shorttrace-excerpt.logfrom aTF_LOG=TRACErun with placeholders, or state that no log was needed.
Expected observation. 40 addresses and 40 files, a wide graph for the independent resources, a visibly longer path after the chain is added, and a smaller edge count after the broad module dependency becomes an output reference. The timing table proves method, not provider performance.
Failure checks. A plan that still proposes 40 creates after apply means the state or backend is wrong. An empty graph means the command ran outside the root. A trace file that grows across runs means TF_LOG_PATH was left set. A -refresh=false plan that differs from the normal plan is drift, not a speed result.
Cost dimensions. Zero cloud spend; a few megabytes of local files and logs; 30 to 45 minutes. If you substitute a cloud provider, add the smallest resources and a cleanup check.
Cleanup. Destroy the lab, remove the diagnostics directories, unset the four TF_LOG variables, and confirm with git status --short that no state, plan or trace remains.
A good diagnostic ends with a causal sentence: "The refresh pass is slow because module-level depends_on serializes 600 reads behind one network module; removing the broad edge and splitting the services root reduced the median refresh from 9m05s to 2m40s." That sentence has a measurement, a mechanism, a change and a rollback; a flag change alone does not.
Next in the Series
In Recover from Partial Applies, Lost State and Emergency Changes, we'll explore Restore trustworthy ownership and service behavior using evidence instead of an assumed rollback button.