Repository navigation
Release 0.56.2: module call scoping (#294, #295), Terragrunt engine match - #296
Merged
Merged
Conversation
A plain reference such as aws_s3_bucket.this, written inside a module, matched every node whose name contained it. When one module folder was called several times, a resource in one call linked to the same resource in every other call; on large roots the extra edges stalled the draw. _find_matching_resources now keeps only matches in the source's module instance (for_each key included), or top-level matches for a top-level source. It falls back to all matches when the instance has none, so references passed in through module variables still resolve. References that already name a module are not scoped. expected-nested-modules.json: removed the cross-call links this bug produced (s3_access_logs versioning, encryption and lifecycle to the documents, frontend, guides and images buckets; mkhan-test ECR lifecycle policy to the pgadmin repository). Each resource keeps the link to its own bucket or repository. Approved by the maintainer.
Terragrunt defaults to OpenTofu when tofu is on PATH, while TerraVision's --engine auto prefers terraform. With both installed, Terragrunt wrote the plan with OpenTofu and TerraVision's terraform show failed: "plan files cannot be transferred between different Terraform versions". _tg_env now sets TG_TF_PATH (and TERRAGRUNT_TFPATH for Terragrunt before 0.73) to TerraVision's engine binary, unless the user already set one.
A module folder's .tf files are parsed once. When the folder was called several times, prefix_module_names() gave the resources to the first call only, and for_each/count instances (module.per_team["a"]) never found them because their addresses carry a key the files lack. Those resources lost the references links are built from, so most of them were drawn unconnected. - prefix_module_names() copies the folder's resources for every call, matching only the most specific module folder. The partial duplication in fileparser (first resource only) is removed. - merge_metadata() looks resources up without module instance keys (without_module_keys). - The per-resource module name drops the instance key, so module variables are found; older debug files are handled too. New replay fixture multi-call-module-tfdata.json (the issue's example) with expected-multi-call-module.json. expected-nested-modules.json, approved by the maintainer: 27 links added and none removed. 20 for the S3 module calls' sub-resources to their own bucket, 1 for pgadmin's ECR lifecycle policy to its repository, 6 for the VPC to the for_each VPC endpoints. 5 security group rule nodes in later calls of the shared sg module gain the ~1 suffix the first call already had; they have no links.
patrickchugh
force-pushed
the
fix/issue-294
branch
from
November 18, 2026 21:53
a8acb2e to
f0feaf7
Compare
ubuntu-latest moved to 26.04, where neato's layout engine is a separate package (libgvplugin-neato-layout8) that graphviz does not pull in. TerraVision's preflight check then stops every run, so every test that calls the CLI failed, on main as well as on pull requests.
Flagged by pip-audit; 1.45.2 is the fixed version.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Release 0.56.2. Closes #294. Closes #295.
1. Scope plain references to their own module instance (#294)
A plain reference such as
aws_s3_bucket.this, written inside a module, matched every node whose name contained it. When one module folder is called several times, a resource in one call linked to the same resource in every other call; on the reporter's roots the edge count went from 425 to 3,838 and the draw stalled._find_matching_resources(modules/graphmaker.py) now keeps only matches in the source resource's module instance,for_eachkey included (module.per_team["a"]), or top-level matches for a top-level source. It falls back to all matches when the instance has none, so references passed in through module variables still resolve. References that already name a module are not scoped.2. Give every module call its .tf attributes (#295)
A module folder's
.tffiles are parsed once. When the folder was called several times, only the first call got the attributes, andfor_each/countinstances never found them. Those resources lost the references links are built from.prefix_module_names()copies the folder's resources for every call (most specific folder only). The old partial duplication infileparseris removed.merge_metadata()looks resources up without module instance keys.3. Terragrunt uses TerraVision's engine binary
Terragrunt defaults to OpenTofu when
tofuis on PATH, while--engine autoprefersterraform, so with both installed reading the plan failed ("plan files cannot be transferred between different Terraform versions")._tg_env()now setsTG_TF_PATH/TERRAGRUNT_TFPATHto TerraVision's binary unless the user set one. Docs updated.4. CI and dependency fixes
ubuntu-latestmoved to Ubuntu 26.04, which ships neato's layout engine as a separate package (libgvplugin-neato-layout8). Preflight stopped every CLI run, so CI failed onmaintoo. Both workflows that install Graphviz now add the plugin when the package exists.opentelemetry-api1.45.1 → 1.45.2 for CVE-2026-126360 (flagged by pip-audit).Expected JSON changes (approved by the maintainer)
tests/json/expected-nested-modules.json:s3_access_logsversioning, encryption and lifecycle to thes3_documents,s3_frontend,s3_guides,s3_imagesbuckets;mkhan-testECR lifecycle policy topgadmin's repository.pgadminECR lifecycle policy to its repository (1), VPC to thefor_eachVPC endpoints (6). 5 security group rule nodes in later calls of the sharedsgmodule gain the~1suffix the first call already had.New replay fixture
multi-call-module-tfdata.json(the #294 example) withexpected-multi-call-module.json.Version
0.56.1 → 0.56.2; MCP pin moved with
scripts/set_versions.py --pin. Plugin version bump follows once PyPI serves 0.56.2.Tests
New:
tests/test_module_scope_matching.py,tests/test_module_calls_metadata.py,TestTgEnv. Full suite locally on the rebased branch (with #290, #291, #293 merged): 2,939 passed.Follow-up
#298: Terraform graph edges are dropped for
for_each/countmodule instances (pre-existing, deferred).