[GH-ISSUE #129] Question: Is it not possible to use only tfstate as input? #72

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

Originally created by @scooter-dangle on GitHub (Aug 22, 2024).
Original GitHub issue: https://github.com/patrickchugh/terravision/issues/129

Based on the bullets in the README about not needing anything beyond my machine, I was thinking I could run terravision without connecting to any of our AWS resources. I assumed this was achieved by giving it read access to our tfstate file, but my attempts to run it this way result in terraform complaining Unhandled error: <class 'UnboundLocalError'>, cannot access local variable 'r' where it is not associated with a value, <traceback object at 0x…>

The command I'm running is

poetry run terravision draw --source /PATH/TO/TFSTATEFILE

I also tried just pointing it at the terraform directory rather than the state file, which so far resulted in it asking what S3 bucket it should store backend data in.

Am I fundamentally missing how it works?

Originally created by @scooter-dangle on GitHub (Aug 22, 2024). Original GitHub issue: https://github.com/patrickchugh/terravision/issues/129 Based on the bullets in the README about not needing anything beyond my machine, I was thinking I could run terravision without connecting to any of our AWS resources. I assumed this was achieved by giving it read access to our tfstate file, but my attempts to run it this way result in terraform complaining `Unhandled error: <class 'UnboundLocalError'>, cannot access local variable 'r' where it is not associated with a value, <traceback object at 0x…>` The command I'm running is ```fish poetry run terravision draw --source /PATH/TO/TFSTATEFILE ``` I also tried just pointing it at the terraform directory rather than the state file, which so far resulted in it asking what S3 bucket it should store backend data in. Am I fundamentally missing how it works?
Author
Owner

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

Hi @scooter-dangle

Have you tried using the latest version ? Just FYI I took a decision deliberately to avoid using the state file since the state file is often on S3, which has a number of issues:

  1. It would require access to your AWS account to read the state
  2. Could contain sensitive info for enterprises.
  3. Requires that your infrastructure is actually created before you can produce a diagram, which means the use is limited when you are inspecting third party TF modules or want to see quickly how your Dev TF environment would compare to prod

I also avoided using the plan output as the sole source of truth because I found it didn't capture all the connections between resources especially when dynamically associated via variables so I had to parse the source code and tf graph in the end anyway.

Hope this helps anyone who wants to understand the decision history on Terravision.

<!-- gh-comment-id:3828107811 --> @patrickchugh commented on GitHub (Jan 31, 2026): Hi @scooter-dangle Have you tried using the latest version ? Just FYI I took a decision deliberately to avoid using the state file since the state file is often on S3, which has a number of issues: 1. It would require access to your AWS account to read the state 2. Could contain sensitive info for enterprises. 3. Requires that your infrastructure is actually created before you can produce a diagram, which means the use is limited when you are inspecting third party TF modules or want to see quickly how your Dev TF environment would compare to prod I also avoided using the plan output as the sole source of truth because I found it didn't capture all the connections between resources especially when dynamically associated via variables so I had to parse the source code and tf graph in the end anyway. Hope this helps anyone who wants to understand the decision history on Terravision.
Author
Owner

@patrickchugh commented on GitHub (Feb 8, 2026):

@scooter-dangle Hi, support for existing terraform PLAN files pre-generated and passed as a parameter via --tfplan is now supported. Please let me know if I can close this issue now?

<!-- gh-comment-id:3868177025 --> @patrickchugh commented on GitHub (Feb 8, 2026): @scooter-dangle Hi, support for existing terraform PLAN files pre-generated and passed as a parameter via --tfplan <file> is now supported. Please let me know if I can close this issue now?
Author
Owner

@scooter-dangle commented on GitHub (Feb 9, 2026):

Sounds great! Definitely close the issue 👍

Will check out the new feature when I have a chance. Thanks!

<!-- gh-comment-id:3870683825 --> @scooter-dangle commented on GitHub (Feb 9, 2026): Sounds great! Definitely close the issue 👍 Will check out the new feature when I have a chance. Thanks!
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#72
No description provided.