mirror of
https://github.com/patrickchugh/terravision.git
synced 2026-05-09 08:25:25 +02:00
[GH-ISSUE #59] Unhandled error: <class 'TypeError'>, unsupported operand type(s) for |: 'dict' and 'dict', <traceback object at 0x7fd145a77f80> #25
Labels
No labels
bug
enhancement
enhancement
good first issue
good first issue
good first issue
pipeline
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/terravision#25
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ViktorUJ on GitHub (Sep 23, 2023).
Original GitHub issue: https://github.com/patrickchugh/terravision/issues/59
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/module_cache/https_//github.com/ViktorUJ/cks//terraform/modules/vpc;main;/terraform/modules/vpc/locals.tf
Found 1 locals stanza(s)
Parsing /root/.terravision/module_cache/https_//github.com/ViktorUJ/cks//terraform/modules/vpc;main;/terraform/modules/vpc/vpc.tf
Found 2 resource stanza(s)
Parsing /root/.terravision/module_cache/https_//github.com/ViktorUJ/cks//terraform/modules/vpc;main;/terraform/modules/vpc/subnet.tf
Found 1 resource stanza(s)
Parsing /root/.terravision/module_cache/https_//github.com/ViktorUJ/cks//terraform/modules/vpc;main;/terraform/modules/vpc/route_table.tf
Found 2 resource stanza(s)
Parsing /root/.terravision/module_cache/https_//github.com/ViktorUJ/cks//terraform/modules/vpc;main;/terraform/modules/vpc/providers.tf
Parsing /root/.terravision/module_cache/https_//github.com/ViktorUJ/cks//terraform/modules/vpc;main;/terraform/modules/vpc/output.tf
Found 5 output stanza(s)
Parsing /root/.terravision/module_cache/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>
@patrickchugh commented on GitHub (Oct 3, 2023):
I will be releasing a significant update that uses the Terraform binary - please test again with that once released.
@patrickchugh commented on GitHub (Nov 21, 2023):
@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.
@patrickchugh commented on GitHub (Dec 28, 2023):
Closing since no feedback
@haisumriaz-tkxel commented on GitHub (Apr 3, 2024):
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

@patrickchugh commented on GitHub (Apr 3, 2024):
Is it possible to share the terraform source so I can try to reproduce? @haisumriaz-tkxel
@haisumriaz-tkxel commented on GitHub (Apr 3, 2024):
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
Main.tf (root)
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]
}
variables.tf
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"
}
@haisumriaz-tkxel commented on GitHub (Apr 3, 2024):
Terraform-Example.zip
here is the complete code that i am using. let me know if i should upload this to some repo or is it ok.
@ly-richlockney commented on GitHub (Apr 4, 2024):
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.
@haisumriaz-tkxel commented on GitHub (Apr 4, 2024):
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.
@ly-richlockney commented on GitHub (Apr 4, 2024):
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.
@haisumriaz-tkxel commented on GitHub (Apr 9, 2024):
@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
@patrickchugh commented on GitHub (May 11, 2024):
Thanks for the bug report. Can you confirm if this still exists with the latest release pushed just now?