[GH-ISSUE #190] Resolve 'Cannot resolve module.X' warnings in tfwrapper module interpolation #116

Closed
opened 2026-05-06 12:37:38 +02:00 by BreizhHardware · 1 comment

Originally created by @bradms98 on GitHub (Apr 14, 2026).
Original GitHub issue: https://github.com/patrickchugh/terravision/issues/190

Problem

When running terravision against aws_prod_network, the parser emits ~18 warnings of the form:

WARNING: Cannot resolve module.<name>, assigning UNKNOWN value in module <caller>

These occur when module-to-module references use expressions the static interpolation resolver in modules/tfwrapper.py can't evaluate (e.g., module.transit_gateway, module.cloud_wan_core_network, module.transit_gateway_attachments.tomap, module.sdwan_vedge.flatten).

Impact

Values get set to UNKNOWN, which likely causes missing or incorrect edges between resources in the rendered diagram (e.g., TGW → VPC attachment → Cloud WAN chains).

Sample warnings observed

  • module.cloud_wan_core_network (from cloud_wan_connect_attachment)
  • module.cloud_wan_vpc_attachment.for (HCL for expression)
  • module.transit_gateway_attachments.tomap (HCL tomap function)
  • module.sdwan_vedge.flatten (HCL flatten function)
  • module.ssm_iam_role.name
  • module.networking_test_server_sg

Suggested investigation

  1. Confirm which warnings indicate missing edges vs. benign (e.g., .for/.tomap/.flatten are function calls, not attributes — parser should skip not warn)
  2. For real cross-module refs (e.g., module.transit_gateway), improve resolution in modules/tfwrapper.py
  3. Downgrade or suppress benign HCL-function-call warnings

Reproduction

.venv/bin/python terravision/terravision.py draw \
  --source ~/git/aws_prod_network \
  --planfile ~/git/aws_prod_network/plan.json \
  --graphfile ~/git/aws_prod_network/graph.dot \
  --filter network \
  --format drawio
Originally created by @bradms98 on GitHub (Apr 14, 2026). Original GitHub issue: https://github.com/patrickchugh/terravision/issues/190 ## Problem When running terravision against `aws_prod_network`, the parser emits ~18 warnings of the form: ``` WARNING: Cannot resolve module.<name>, assigning UNKNOWN value in module <caller> ``` These occur when module-to-module references use expressions the static interpolation resolver in `modules/tfwrapper.py` can't evaluate (e.g., `module.transit_gateway`, `module.cloud_wan_core_network`, `module.transit_gateway_attachments.tomap`, `module.sdwan_vedge.flatten`). ## Impact Values get set to `UNKNOWN`, which likely causes missing or incorrect edges between resources in the rendered diagram (e.g., TGW → VPC attachment → Cloud WAN chains). ## Sample warnings observed - `module.cloud_wan_core_network` (from `cloud_wan_connect_attachment`) - `module.cloud_wan_vpc_attachment.for` (HCL `for` expression) - `module.transit_gateway_attachments.tomap` (HCL `tomap` function) - `module.sdwan_vedge.flatten` (HCL `flatten` function) - `module.ssm_iam_role.name` - `module.networking_test_server_sg` ## Suggested investigation 1. Confirm which warnings indicate missing edges vs. benign (e.g., `.for`/`.tomap`/`.flatten` are function calls, not attributes — parser should skip not warn) 2. For real cross-module refs (e.g., `module.transit_gateway`), improve resolution in `modules/tfwrapper.py` 3. Downgrade or suppress benign HCL-function-call warnings ## Reproduction ```sh .venv/bin/python terravision/terravision.py draw \ --source ~/git/aws_prod_network \ --planfile ~/git/aws_prod_network/plan.json \ --graphfile ~/git/aws_prod_network/graph.dot \ --filter network \ --format drawio ```
Author
Owner

@bradms98 commented on GitHub (Apr 14, 2026):

Created in wrong repo, moving to fork

<!-- gh-comment-id:4245092931 --> @bradms98 commented on GitHub (Apr 14, 2026): Created in wrong repo, moving to fork
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#116
No description provided.