[GH-ISSUE #159] Terravision hangs in resolve_all_variables() when source is tfdata.json (stuck in strip_var_curlies) #91

Closed
opened 2026-05-06 12:37:23 +02:00 by BreizhHardware · 2 comments

Originally created by @ClementV78 on GitHub (Jan 22, 2026).
Original GitHub issue: https://github.com/patrickchugh/terravision/issues/159

Summary

Terravision hangs during variable resolution when using a tfdata.json source. The process spins CPU and never reaches rendering. Stack trace shows it looping in:
modules/interpreter.py -> find_replace_values -> helpers.strip_var_curlies

Environment

  • Terravision: 0.10.2 (pipx)
  • Python: 3.12.3
  • Terraform: 1.13.2
  • OS: Linux (Ubuntu/Debian based)

Repro steps

  1. Generate a tfdata.json with debug:
    terravision draw --source /path/to/terraform --debug
  2. Try to render from the JSON:
    terravision draw --source /path/to/tfdata.json --format png --outfile /tmp/out.png

Observed

  • CPU stays high, no output file produced.
  • No Graphviz processes running (dot/neato/gvpr).
  • Faulthandler trace shows loop in:
    modules/helpers.py: strip_var_curlies
    modules/interpreter.py: find_replace_values

Expected

Rendering should complete from tfdata.json without re-running variable resolution.

Workaround

Bypass Terravision CLI and call drawing.render_diagram() directly using the venv python:

  • Load tfdata.json
  • Ensure provider_detection exists
  • Call drawing.render_diagram(tfdata, False, False, outfile, format, source)
    This produces the output immediately.

Notes

The hang happens before Graphviz, during _enrich_graph_data() / resolve_all_variables().

Current thread 0x00007eafe6fc1080 (most recent call first):
  File ".../site-packages/modules/helpers.py", line 1161, in strip_var_curlies
  File ".../site-packages/modules/interpreter.py", line 483, in find_replace_values
  File ".../site-packages/modules/interpreter.py", line 165, in handle_metadata_vars
  File ".../site-packages/modules/interpreter.py", line 43, in resolve_all_variables
  File ".../site-packages/terravision/terravision.py", line 167, in _enrich_graph_data
  File ".../site-packages/terravision/terravision.py", line 249, in compile_tfdata
  File ".../site-packages/terravision/terravision.py", line 633, in draw
Originally created by @ClementV78 on GitHub (Jan 22, 2026). Original GitHub issue: https://github.com/patrickchugh/terravision/issues/159 ## Summary Terravision hangs during variable resolution when using a tfdata.json source. The process spins CPU and never reaches rendering. Stack trace shows it looping in: modules/interpreter.py -> find_replace_values -> helpers.strip_var_curlies ## Environment - Terravision: 0.10.2 (pipx) - Python: 3.12.3 - Terraform: 1.13.2 - OS: Linux (Ubuntu/Debian based) ## Repro steps 1. Generate a tfdata.json with debug: terravision draw --source /path/to/terraform --debug 2. Try to render from the JSON: terravision draw --source /path/to/tfdata.json --format png --outfile /tmp/out.png ## Observed - CPU stays high, no output file produced. - No Graphviz processes running (dot/neato/gvpr). - Faulthandler trace shows loop in: modules/helpers.py: strip_var_curlies modules/interpreter.py: find_replace_values ## Expected Rendering should complete from tfdata.json without re-running variable resolution. ## Workaround Bypass Terravision CLI and call drawing.render_diagram() directly using the venv python: - Load tfdata.json - Ensure provider_detection exists - Call drawing.render_diagram(tfdata, False, False, outfile, format, source) This produces the output immediately. ## Notes The hang happens before Graphviz, during _enrich_graph_data() / resolve_all_variables(). ``` Current thread 0x00007eafe6fc1080 (most recent call first): File ".../site-packages/modules/helpers.py", line 1161, in strip_var_curlies File ".../site-packages/modules/interpreter.py", line 483, in find_replace_values File ".../site-packages/modules/interpreter.py", line 165, in handle_metadata_vars File ".../site-packages/modules/interpreter.py", line 43, in resolve_all_variables File ".../site-packages/terravision/terravision.py", line 167, in _enrich_graph_data File ".../site-packages/terravision/terravision.py", line 249, in compile_tfdata File ".../site-packages/terravision/terravision.py", line 633, in draw ```
Author
Owner

@patrickchugh commented on GitHub (Jan 22, 2026):

@ClementV78 Can you try with the latest version of the code I just pushed?

<!-- gh-comment-id:3787101230 --> @patrickchugh commented on GitHub (Jan 22, 2026): @ClementV78 Can you try with the latest version of the code I just pushed?
Author
Owner

@patrickchugh commented on GitHub (Jan 31, 2026):

Can I close this @ClementV78 ¿

<!-- gh-comment-id:3828097237 --> @patrickchugh commented on GitHub (Jan 31, 2026): Can I close this @ClementV78 ¿
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/terravision#91
No description provided.