Python error IndexError: list index out of range
See original GitHub issueDescribe the bug I get this error for any of my terraform modules. Could it be due to tfvars files? Is there some way to specify a var file to use?
$ checkov -d /path/to/module
Traceback (most recent call last):
File "/usr/local/bin/checkov", line 24, in <module>
report = Runner().run(root_folder)
File "/usr/local/lib/python3.8/site-packages/checkov/terraform/runner.py", line 22, in run
scanned_file = definition[0].split(root_folder)[1]
IndexError: list index out of range
My terraform module is formatted as folows:
├── apis.tf
├── dataflow.tf
├── env
│ ├── backend
│ │ ├── development.tfvars
│ │ ├── production.tfvars
│ │ └── staging.tfvars
│ ├── development.tfvars
│ ├── production.tfvars
│ └── staging.tfvars
├── main.tf
├── variables.tf
└── versions.tf
To Reproduce Steps to reproduce the behavior:
- run
checkov -d /path/to/module
- See error
Expected behavior Output
Desktop (please complete the following information):
- OS: python:alpine docker image
- Checkov Version [e.g. 22]: 1.0.78
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
List Index Out of Range – Python Error Message Solved
You'll get the Indexerror: list index out of range error when iterating through a list and trying to access an item that doesn't...
Read more >Indexerror: list Index Out of Range in Python - STechies
“List index out of range” error occurs in Python when we try to access an undefined element from the list. The only way...
Read more >Python IndexError: List Index Out of Range [Easy Fix] - Finxter
The error “list index out of range” arises if you access invalid indices in your ...
Read more >Index Error: list index out of range (Python) - Stack Overflow
Generally it means that you are providing an index for which a list element does not exist. E.g, if your list was [1,...
Read more >Python IndexError: List Index Out of Range Error Explained
What is the Python IndexError? ... We can break down the text a little bit. We can see here that the message tells...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, that is correct. The path I entered is to the location of main.tf. It’s version 0.12
I’ll send an example shortly. Will try narrow it down too 👍🏻
closing due to inactivity.