Add Terraform support with new analyzer and symbol extraction#2
Add Terraform support with new analyzer and symbol extraction#2xgourmandin wants to merge 3 commits into
Conversation
scheidydude
left a comment
There was a problem hiding this comment.
Thanks for the contribution! Tested the analyzer end-to-end — the structure is solid and the symbol extraction works well. Two things to fix before merging:
🐛 Bug: macOS symlink path resolution breaks cross-module links
In terraform_analyzer.py, two places call .resolve().relative_to(root):
- Phase 1 (~line 213): building
module_src_resolved_map - Phase 2 (~line 249): generating module source links
On macOS, /var/folders/... resolves through a symlink to /private/var/folders/.... When root is unresolved and the resolved path has the /private prefix, relative_to(root) raises ValueError — which is silently caught, so all cross-module links are silently dropped.
Fix: use root.resolve() instead of root in both relative_to() calls:
# Phase 1
target_dir = str(
(f_tmp.parent / mod_src).resolve().relative_to(root.resolve())
)
# Phase 2
target_dir = str(
(f.parent / mod_src).resolve().relative_to(root.resolve())
)⚠️ Please remove .claude/settings.local.json from the PR
This file contains your local machine paths and personal Claude Code permissions. It's specific to your environment and will conflict with ours. Please add it to .gitignore on your fork or revert the file from the PR.
Everything else looks good — the two-phase directory-scoped analysis, intra-module reference resolution, provider/registry external nodes, and the symbol extractor are all well-implemented. Happy to merge once these two are addressed.
|
Hey, Fixed the path resolution as mentioned. I do not have access to a MacOS so I hope this works as expected. |
|
Three issues below. Please review and tell me if they are issues or were intentional. Issues
|
For my personal needs, I tried to add support for Terraform.
This implementation was done with the help of Claude. So feel free to integrate it, or not.
I tested it on a real life Terraform project (multi layer/modules) and it seems to work pretty well.
NOTE : before going further, I only validated this using the visualization. I need to do some more tests with the other commands to see if this is really helpfull or not