Closed ViktorUJ closed 11 months ago
I will be releasing a significant update that uses the Terraform binary - please test again with that once released.
@ViktorUJ 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.
Closing since no feedback
Hi This issue is still there as of April 3, 2024. i recently cloned the repo, and followed the instructions to setup terravision, but its still here. im using the Main branch. please let me know how i can troubleshoot this
Is it possible to share the terraform source so I can try to reproduce? @haisumriaz-tkxel
Sure. let me know if im doing something wrong.
Here is the Structure! terraform/ │ ├── main.tf ├── variables.tf ├── outputs.tf │ └── modules/ ├── vpc/ │ ├── main.tf │ ├── variables.tf │ └── outputs.tf │ ├── subnets/ │ ├── main.tf │ ├── variables.tf │ └── outputs.tf │ ├── igw/ │ ├── main.tf │ └── outputs.tf │ ├── ec2_instance/ │ ├── main.tf │ ├── variables.tf │ └── outputs.tf │ └── security_group/ ├── main.tf ├── variables.tf └── outputs.tf
module "vpc" { source = "./modules/vpc" cidr_block = var.vpc_cidr }
module "subnets" { source = "./modules/subnets" vpc_id = module.vpc.vpc_id public_cidr = var.public_subnet_cidr private_cidr = var.private_subnet_cidr }
module "igw" { source = "./modules/igw" vpc_id = module.vpc.vpc_id }
module "security_groups" { source = "./modules/security_groups" security_group_name_prefix = "example" vpc_id = module.vpc.vpc_id public_subnet_cidr = var.public_subnet_cidr # Ensure this is defined in your variables }
module "ec2_instance_public" { source = "./modules/ec2_instance" ami_id = "ami-080e1f13689e07408" # Replace with actual AMI ID subnet_id = module.subnets.public_subnet_id vpc_security_group_ids = [module.security_groups.public_sg_id] }
module "ec2_instance_private" { source = "./modules/ec2_instance" ami_id = "ami-080e1f13689e07408" # Replace with actual AMI ID subnet_id = module.subnets.private_subnet_id vpc_security_group_ids = [module.security_groups.private_sg_id] }
variable "vpc_cidr" { description = "The CIDR block for the VPC" default = "10.0.0.0/16" }
variable "public_subnet_cidr" { description = "The CIDR block for the public subnet" default = "10.0.1.0/24" }
variable "private_subnet_cidr" { description = "The CIDR block for the private subnet" default = "10.0.2.0/24" }
here is the complete code that i am using. let me know if i should upload this to some repo or is it ok.
What version of Python are you using? I got that error when I attempted with Python 3.8.10. After upgrading to 3.9, I was able to move past that. I mean, I ran into a different error afterward, but it's progress.
I currently have 3.8.10 installed. let me try upgrading it. Please share what error did you run into so i can compare if its the same or something else.
The application progresses through most of my plan, and then when it hits a stage labeled "Checking for additional links between X resources..", it steps through a number of aws_ resources and ends with:
"Unhandled error: <class 'KeyError'>, 'count', <traceback object at 0x7f696363e580>"
Note: I initially received a similar KeyError with regard to EFS volumes, so I commented out the EFS section in terravision/modules/cloud_config.py. Just to see if it was just hanging up on that one resource.
This, BTW is on Ubuntu 20 via WSL, with Python 3.9.
Other note: I am not very proficient at this at all. I just happened across the same issue that you did, but managed to get past it.
@ly-richlockney i also managed to get past that by upgrading python version. facing this same new error, seems like there is another ticket that was open for this newer error. @patrickchugh can we have a look at that one instead? this one was resolved using python 3.10.13 on ubuntu 20.04 LTS
Thanks for the bug report. Can you confirm if this still exists with the latest release pushed just now?
I try terravision draw --source https://github.com/ViktorUJ/cks//terraform/modules/vpc
terravision draw --source https://github.com/ViktorUJ/cks//terraform/modules/vpc
/ _ _ ()() __ / /\/ \ '| '/ ` \ \ / / / | |/ | ' \ / / | / | | | | (| |\ V /| _ \ | (_) | | | | \/ _|| || _,| _/ ||/_|__/|| |_|
Preflight check.. dot command detected: /usr/bin/dot gvpr command detected: /usr/bin/gvpr git command detected: /usr/bin/git Loading Sources.. Downloading External Module: https://github.com/ViktorUJ/cks//terraform/modules/vpc Cloning from Terraform registry source: https://github.com/ViktorUJ/cks Added Source Location: https://github.com/ViktorUJ/cks//terraform/modules/vpc Parsing /root/.terravision/modulecache/https//github.com/ViktorUJ/cks//terraform/modules/vpc;main;/terraform/modules/vpc/locals.tf Found 1 locals stanza(s) Parsing /root/.terravision/modulecache/https//github.com/ViktorUJ/cks//terraform/modules/vpc;main;/terraform/modules/vpc/vpc.tf Found 2 resource stanza(s) Parsing /root/.terravision/modulecache/https//github.com/ViktorUJ/cks//terraform/modules/vpc;main;/terraform/modules/vpc/subnet.tf Found 1 resource stanza(s) Parsing /root/.terravision/modulecache/https//github.com/ViktorUJ/cks//terraform/modules/vpc;main;/terraform/modules/vpc/route_table.tf Found 2 resource stanza(s) Parsing /root/.terravision/modulecache/https//github.com/ViktorUJ/cks//terraform/modules/vpc;main;/terraform/modules/vpc/providers.tf Parsing /root/.terravision/modulecache/https//github.com/ViktorUJ/cks//terraform/modules/vpc;main;/terraform/modules/vpc/output.tf Found 5 output stanza(s) Parsing /root/.terravision/modulecache/https//github.com/ViktorUJ/cks//terraform/modules/vpc;main;/terraform/modules/vpc/var.tf Found 7 variable stanza(s) Processing Variables.. var.region var.az_ids var.vpc_default_cidr var.aws var.prefix var.app_name var.tags_common aws_vpc.default aws_internet_gateway.default aws_subnet.subnets_pub aws_route_table.pub aws_route_table_association.pub
Locals list : /main: item_id /main: subnets_az /main: subnets_az_cmdb /main: tags_app /main: tags_all
Module list :
Resource list : vpc/vpc.tf: aws_vpc.default vpc/vpc.tf: aws_internet_gateway.default vpc/subnet.tf: aws_subnet.subnets_pub vpc/route_table.tf: aws_route_table.pub vpc/route_table.tf: aws_route_table_association.pub
Data list :
Variable List:
Conditional Resource List:
Computing Relations between 5 out of 5 resources... aws_vpc.default --> aws_internet_gateway.default (Reversed) aws_vpc.default --> aws_subnet.subnets_pub (Reversed) aws_vpc.default --> aws_route_table.pub (Reversed) aws_route_table.pub --> aws_internet_gateway.default aws_subnet.subnets_pub --> aws_route_table_association.pub (Reversed) aws_route_table_association.pub --> aws_route_table.pub aws_subnet.subnets_pub --> aws_route_table_association.pub (Reversed)
Unprocessed Graph Dictionary: { "aws_internet_gateway.default": [], "aws_route_table.pub": [ "aws_internet_gateway.default" ], "aws_route_table_association.pub": [ "aws_route_table.pub" ], "aws_subnet.subnets_pub": [ "aws_route_table_association.pub" ], "aws_vpc.default": [ "aws_internet_gateway.default", "aws_subnet.subnets_pub", "aws_route_table.pub" ] } Unhandled error: <class 'TypeError'>, unsupported operand type(s) for |: 'dict' and 'dict', <traceback object at 0x7f2416a270c0>