Skip to content
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

Skip No Terraform Config Files Error #1323

Open
rosshukla1 opened this issue Jul 12, 2022 · 5 comments
Open

Skip No Terraform Config Files Error #1323

rosshukla1 opened this issue Jul 12, 2022 · 5 comments

Comments

@rosshukla1
Copy link

rosshukla1 commented Jul 12, 2022

terrascan version: 1.14.0
Operating System: Linux (ubuntu 20.04)

Description: Hoping to have a flag to skip/ignore the error code regarding not having terraform config files within a directory. I am using Azure DevOps and because of the "4" error code, the pipeline does not proceed despite having no pressing violations/other errors. Still want to be able to pick up on other errors in configuration.

What I Did:
terrascan scan -t azure -i terraform --skip-rules="AC_AZURE_XXXX" --show-passed -v -o junit-xml > $(System.DefaultWorkingDirectory)/TerrascanReport/Terrascan-Report.xml

It was only when I passed the command through the console (no -o flag) that I saw the reason for the error: directory '/xxx/scripts' has no terraform config files

Desired Outcome: There are two situations where it would be helpful to have a flag to ignore the above error:

-directories that contain directories with and without terraform files (i.e. within /xxx there is a /xxx/scripts and /xxx/terraformfiles)

-directories that contain terraform files recursively (ie /modules/moduleA/terraformfiles currently gets an error because technically the moduleA directory is not a terraform file. All the files were scanned for violations but it still counted as an error).

Thank you.

@tolidano
Copy link

This error is here:
https://github.com/tenable/terrascan/blob/master/pkg/iac-providers/terraform/commons/load-dir.go#L135

It also appears here (non-recursive):
https://github.com/tenable/terrascan/blob/master/pkg/iac-providers/terraform/commons/load-dir.go#L261

The non-recursive version probably needs this error, otherwise it doesn't make sense - to scan a folder non-recursively and not find any files.

However, in the recursive version, it is unreasonable to expect this.

@rosshukla1
Copy link
Author

rosshukla1 commented Aug 1, 2022

Update: thanks! did not see PR before.

Hello, I'm a little confused by those links. Is there a way to change the behavior of the error? What do you recommend as next steps here @tolidano

@tolidano
Copy link

tolidano commented Aug 1, 2022

I opened a PR, see above.

@luboszima
Copy link

Any updated?

@EliiseS
Copy link

EliiseS commented Nov 14, 2024

@nbajaj-tenable is this project being maintained? What's happening?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants