-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected exit code of 4 when running a scan on an empty directory #1036
Comments
I get this same Note: I am using the Docker container method: docker run --rm --volume $(System.DefaultWorkingDirectory):/code \
accurics/terrascan scan --iac-dir /code/ --verbose --config-path code/terrascan.toml \ Scan Summary -
File/Folder : /code
IaC Type : all
Scanned At : 2021-10-03 17:46:25.094059433 +0000 UTC
Policies Validated : 60
Violated Policies : 0
Low : 0
Medium : 0
High : 0
##[debug]Exit code 4 received from tool '/usr/bin/bash'
##[debug]STDIO streams have closed for tool '/usr/bin/bash'
##[error]Bash exited with code '4'. TerraScan TOML file: [severity]
level = "high"
[rules]
skip-rules = [
"AC_AWS_0207",
"AC_AWS_0214",
"AC_AWS_0215",
"AC_AWS_0366",
"AC_DOCKER_0029"
] |
Running into the same problem (with the skip-rules configuration), which actually let's the terrascan-action for GitHub fail. It could probably be related to the changes in #994 where the exit code behavior was changed. |
I looked deeper into my problem. Essentially I got the exit code 4, because I had directories in my project, which did not contain any Terraform files. It was not due to the skip-rules configuration. After fixing my initial problem also the skip-rules return an exit code 0. I think the problem is that even in verbose mode there are not a lot of pointers on what is going wrong. I had to add some additional logging to As it was mentioned somewhere that we're simulating |
When running for all IaC types, I'm always getting an error exit code when there are no Docker files present in the directories.
The tool shouldn't exit with an error exit code if no Docker files are present. |
Same here: |
Output log in MegaLinter:
|
Hi @yane3628 this is just a warning it is not being used in error code computation. |
@nvuillam can you please try running the same command with output type as json |
the I know this doesn't solve most peoples problem in this issue, but I'll leave this note for anyone. |
@jb185555 Thanks for this tip, setting the IaC to terraform made it produce exit code 0 for me. The only problem I have is the docs are broken for the config file references and I can't get the config file to auto set my iac type |
dumbest of dumb suggestions but: I dropped an |
I have tried and I am still getting this. When I run the command: terrascan scan d . -i terraform -t all -v -o json I get: { Why does it error when there is a directory with no .tf files? Is there a way of configuring Terrascan to ignore some directories? |
Any change to have a fix someday about this issue ? :) |
any updates on this issue ? |
Description
I am running a
terrascan scan
on an empty directory and it is failing with an exit code of 4. When I provide secure terraform, it provides the exact same output, but exits 0.What I Did
Empty directory:
Valid, secure .tf file
Valid, insecure .tf file:
My
~/.terraformrc
file is:plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"
The text was updated successfully, but these errors were encountered: