Closed dnk8n closed 11 months ago
Command I ran:
poetry run terravision draw --source ~/src/dtrack --varfile ~/src/dtrack/terraform.tfvars
My setup/install procedure:
sudo apt update && sudo apt install graphviz
cd /tmp
git clone git@github.com:patrickchugh/terravision.git
cd /tmp/terravision
export PATH=$PATH:$(pwd)
poetry install
I'm also encountering this. Did you find a way to get around this issue?
@dnk8n @maker2413 Hello, thank you for your feedback and thanks for testing out Terravision and helping to make this a better product. I have recently completed a major revamp to the code which uses the terraform binary to download source files and generate initial relationships, before augmenting it with source code parsing as before. This is a significant departure from the previous approach and whilst slower, ensures a more accurate output and will handle all terraform in built functions now when encountered in the source. Please do a git pull and re-test again with the latest source code. If your problem is resolved, please close the the thread in github issues and mark it as completed. If not, please give as much detail as you can about the errors and include any source files if possible so I can reproduce your issue. Once again, thanks for helping and look forward to hearing from you soon.
P.
can this issue be closed now?
I plan to be able to give feedback this week. It’s on my task list. Please understand that terravision is not right at the top. Anyone else able to validate and report their experience?
On Wed, 29 Nov 2023 at 11:31, Patrick Chugh @.***> wrote:
can this issue be closed now?
— Reply to this email directly, view it on GitHub https://github.com/patrickchugh/terravision/issues/66#issuecomment-1831531879, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZHR2IZOMCRF23UV3SEGE3YG36IJAVCNFSM6AAAAAA6UGB5WKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZRGUZTCOBXHE . You are receiving this because you were mentioned.Message ID: @.***>
I had a go with the new code, thanks for your patience... I understand how exciting it is to roll out a new feature and how frustrating it is waiting for feedback!
First, my project used a backend conf for terraform init, so I needed to hardcode that for this exercise - logged an issue here: https://github.com/patrickchugh/terravision/issues/85
Then when reinstalling from scratch, I needed to manually install debugpy before I could continue.
Now that I am properly installed, I could run:
(terravision-py3.10) dean@dean-ThinkPad-X250:/tmp/terravision$ terravision draw --source ~/src/dtrack --varfile ~/src/dtrack/terraform.tfvars
It did all the right things until the end:
Plan: 12 to add, 0 to change, 0 to destroy.
─────────────────────────────────────────────────────────────────────
Saved the plan to: tfplan.bin
To perform exactly these actions, run the following command to apply:
terraform apply "tfplan.bin"
Analysing plan..
Unprocessed terraform graph dictionary:
{
"aws_instance.dtrack_instance": [
"cloudflare_record.dtrack_record",
"cloudflare_record.dtrack_traefik_record"
],
"aws_internet_gateway.dtrack_igw": [
"aws_route_table.dtrack_route_table"
],
"aws_key_pair.dtrack_key_pair": [
"aws_instance.dtrack_instance"
],
"aws_route_table.dtrack_route_table": [
"aws_route_table_association.dtrack_route_table_association"
],
"aws_route_table_association.dtrack_route_table_association~1": [],
"aws_security_group.dtrack_sg": [
"aws_instance.dtrack_instance"
],
"aws_subnet.dtrack_subnet~1": [
"aws_instance.dtrack_instance",
"aws_route_table_association.dtrack_route_table_association"
],
"aws_vpc.dtrack_vpc": [
"aws_internet_gateway.dtrack_igw",
"aws_security_group.dtrack_sg",
"aws_subnet.dtrack_subnet",
"aws_subnet.dtrack_subnet~1"
],
"cloudflare_record.dtrack_record": [],
"cloudflare_record.dtrack_traefik_record": [],
"github_repository_deploy_key.dtrack_deploy_key": [],
"local_file.ansible_hosts": []
}
Parsing Terraform Source Files..
Added Source Location: /
ERROR: No Terraform .tf files found in current directory or your source location. Use --source parameter to specify location or Github URL of source files
Even changing current directory to where my main.tf lives didn't produce a different result.
@dnk8n Thanks for the feedback and patience. I have just made some bugfixes to this. Can you please try to run with latest code?
Working on the terraform init part separately
It gets this far, and then hangs:
Plan: 12 to add, 0 to change, 0 to destroy.
─────────────────────────────────────────────────────────────────────
Saved the plan to: /tmp/tfplan.bin
To perform exactly these actions, run the following command to apply:
terraform apply "/tmp/tfplan.bin"
Analysing plan..
Unprocessed terraform graph dictionary:
{
"aws_instance.dtrack_instance": [
"cloudflare_record.dtrack_record",
"cloudflare_record.dtrack_traefik_record"
],
"aws_internet_gateway.dtrack_igw": [
"aws_route_table.dtrack_route_table"
],
"aws_key_pair.dtrack_key_pair": [
"aws_instance.dtrack_instance"
],
"aws_route_table.dtrack_route_table": [
"aws_route_table_association.dtrack_route_table_association"
],
"aws_route_table_association.dtrack_route_table_association~1": [],
"aws_security_group.dtrack_sg": [
"aws_instance.dtrack_instance"
],
"aws_subnet.dtrack_subnet~1": [
"aws_instance.dtrack_instance",
"aws_route_table_association.dtrack_route_table_association"
],
"aws_vpc.dtrack_vpc": [
"aws_internet_gateway.dtrack_igw",
"aws_security_group.dtrack_sg",
"aws_subnet.dtrack_subnet",
"aws_subnet.dtrack_subnet~1"
],
"cloudflare_record.dtrack_record": [],
"cloudflare_record.dtrack_traefik_record": [],
"github_repository_deploy_key.dtrack_deploy_key": [],
"local_file.ansible_hosts": []
}
Parsing Terraform Source Files..
Added Source Location: /home/dean/src/dtrack
Parsing /home/dean/src/dtrack/terraform.tfvars.tpl
Parsing /home/dean/src/dtrack/terraform.tfvars
Parsing /home/dean/src/dtrack/main.tf
Found 9 variable stanza(s)
Found 1 locals stanza(s)
Found 12 resource stanza(s)
Found 3 data stanza(s)
Will use auto variables from file : /home/dean/src/dtrack/terraform.tfvars.tpl
Will use auto variables from file : /home/dean/src/dtrack/terraform.tfvars
Processing variables..
Processing resources..
Not sure how it found Parsing /home/dean/src/dtrack/terraform.tfvars.tpl
Deleting the .tpl file and rerunning doesn't change the result.
How long is the process expected to take. Unfortunately in South Africa we have electricity load shedding, and my laptop battery is about to die. Will try again when back online.
Seems to just hang. 37min and still going (using 100% of one thread) ...
@dnk8n Would you have time to git pull the latest code and try again?
Looks much better! I think enough to close this issue.
Maybe you know better than me @patrickchugh if it is showing all the available AWS resources (compare the dictionaries to the image). Seems to be missing detail?
FYI:
Saved the plan to: /tmp/tfplan.bin
To perform exactly these actions, run the following command to apply:
terraform apply "/tmp/tfplan.bin"
Analysing plan..
Unprocessed terraform graph dictionary:
{
"aws_instance.dtrack_instance": [
"cloudflare_record.dtrack_record",
"cloudflare_record.dtrack_traefik_record"
],
"aws_internet_gateway.dtrack_igw": [
"aws_route_table.dtrack_route_table"
],
"aws_key_pair.dtrack_key_pair": [
"aws_instance.dtrack_instance"
],
"aws_route_table.dtrack_route_table": [
"aws_route_table_association.dtrack_route_table_association~1"
],
"aws_route_table_association.dtrack_route_table_association~1": [],
"aws_security_group.dtrack_sg": [
"aws_instance.dtrack_instance"
],
"aws_subnet.dtrack_subnet~1": [
"aws_instance.dtrack_instance",
"aws_route_table_association.dtrack_route_table_association~1"
],
"aws_vpc.dtrack_vpc": [
"aws_internet_gateway.dtrack_igw",
"aws_security_group.dtrack_sg",
"aws_subnet.dtrack_subnet~1",
"aws_subnet.dtrack_subnet~1"
],
"cloudflare_record.dtrack_record": [],
"cloudflare_record.dtrack_traefik_record": [],
"github_repository_deploy_key.dtrack_deploy_key": [],
"local_file.ansible_hosts": []
}
Parsing Terraform Source Files..
Added Source Location: /home/dean/src/dtrack
Parsing /home/dean/src/dtrack/terraform.tfvars
Parsing /home/dean/src/dtrack/main.tf
Found 9 variable stanza(s)
Found 1 locals stanza(s)
Found 12 resource stanza(s)
Found 3 data stanza(s)
Will use auto variables from file : /home/dean/src/dtrack/terraform.tfvars
Processing variables..
Processing resources..
aws_vpc.dtrack_vpc
aws_subnet.dtrack_subnet
aws_internet_gateway.dtrack_igw
aws_route_table.dtrack_route_table
aws_route_table_association.dtrack_route_table_association
aws_security_group.dtrack_sg
aws_key_pair.dtrack_key_pair
aws_instance.dtrack_instance
cloudflare_record.dtrack_record
cloudflare_record.dtrack_traefik_record
github_repository_deploy_key.dtrack_deploy_key
local_file.ansible_hosts
Checking for additional links between 12 resources..
aws_instance.dtrack_instance --> aws_instance.dtrack_instance
aws_vpc.dtrack_vpc --> aws_route_table.dtrack_route_table
Enriched graphviz dictionary:
{
"aws_az.af~south~1a": [
"aws_subnet.dtrack_subnet~1"
],
"aws_instance.dtrack_instance": [
"aws_instance.dtrack_instance"
],
"aws_internet_gateway.igw": [
"aws_route_table.dtrack_route_table",
"tv_aws_internet.internet"
],
"aws_key_pair.dtrack_key_pair": [
"aws_instance.dtrack_instance"
],
"aws_route_table.dtrack_route_table": [
"aws_route_table_association.dtrack_route_table_association~1"
],
"aws_route_table_association.dtrack_route_table_association~1": [],
"aws_security_group.dtrack_sg": [
"aws_instance.dtrack_instance"
],
"aws_subnet.dtrack_subnet~1": [
"aws_route_table_association.dtrack_route_table_association~1",
"aws_security_group.dtrack_sg"
],
"aws_vpc.dtrack_vpc": [
"aws_az.af~south~1a",
"aws_internet_gateway.igw",
"aws_route_table.dtrack_route_table",
"aws_security_group.dtrack_sg",
"aws_subnet.dtrack_subnet~1"
],
"cloudflare_record.dtrack_record": [
"aws_instance.dtrack_instance"
],
"cloudflare_record.dtrack_traefik_record": [
"aws_instance.dtrack_instance"
],
"github_repository_deploy_key.dtrack_deploy_key": [],
"local_file.ansible_hosts": [],
"tv_aws_internet.internet": []
}
Rendering Architecture Image...
Output file: /home/dean/src/dtrack/architecture.dot.png
Completed!
@dnk8n I found there are a few glitches in the diagram you got. If you can open a new issue regarding this bug handling security groups and share your code I can make it output the correct image similar to this one attached:
CLI output hung, in case template is useful for debugging:
terraform.tfvars