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

Adding support for tfvars in terraform scanning #241

Open
yossigilad opened this issue Jun 20, 2023 · 16 comments
Open

Adding support for tfvars in terraform scanning #241

yossigilad opened this issue Jun 20, 2023 · 16 comments

Comments

@yossigilad
Copy link

Hi, can you please add support to specify tfvars in Terraform scanning, similar to the CLI?
CLI example:
trivy config . --tf-vars ./envs/xxx.tfvars

@simar7
Copy link
Member

simar7 commented Jun 20, 2023

All trivy options are available via the trivy config file, even those that are today not available as dedicated options via the trivy action.

You can read more on how to use the trivy config file here: https://aquasecurity.github.io/trivy/v0.42/docs/references/configuration/config-file/

@simar7 simar7 closed this as completed Jun 20, 2023
@yossigilad
Copy link
Author

yossigilad commented Jun 21, 2023

@simar7 Thanks for the quick answer, but for tfvars config file is not a good option, because its dynamic for every pr. Please consider again and think that customers are having a lot of tf workspaces.

@simar7
Copy link
Member

simar7 commented Jun 21, 2023

sorry I didn't mean to close the issue, pressed the wrong button by accident.

Could you clarify what you mean by "dynamic"? today the --tf-vars flag accepts a path to a file where the terraform variables are defined. Using this from the CLI option or the trivy configuration file is no different.

@simar7 simar7 reopened this Jun 21, 2023
@yossigilad
Copy link
Author

@simar7 when using ftvars there are more then one file, and we need to spesify for every env the ftvar, and if we want to use the trivy.conf we will need to create it dynmicly with the tfvar name or create many conf files.
example:
image
in the screen shot there are 2 tfvar files, and they can enable or dissable some of the tf code, so if we want to scan the exact vul we need to spesify the tfvar file in the trivy scan. so it will be much easier to spesify it in the action code and not use the conf file.

@yossigilad
Copy link
Author

@simar7 any update?

@simar7
Copy link
Member

simar7 commented Jun 27, 2023

so it will be much easier to spesify it in the action code and not use the conf file.

I'm not sure if I understand this. Could you explain how it will be easier? CLI options and config file are identical and have the same behaviour.

@yossigilad
Copy link
Author

@simar7 Think that I need to create config file for every tfvar file. The number of files will be same as workspaces ( from one to many)

@simar7
Copy link
Member

simar7 commented Jun 28, 2023

In that case, how would you be able to "dynamically" specify tf-vars when using them as a GitHub action parameter? Does GitHub allow that?

@yossigilad
Copy link
Author

if you will give the option to spesify it as varibale in trivy action, I can set it with env like others action that using the tfvars (terraform apply and more)

@yossigilad
Copy link
Author

@simar7 any update? or you need more information?

@simar7
Copy link
Member

simar7 commented Jul 11, 2023

We welcome a PR if you'd like to contribute.

@yossigilad
Copy link
Author

Sure, I will try to create a pr

@kderck
Copy link
Contributor

kderck commented Oct 3, 2023

Hi. This would be great

@kderck
Copy link
Contributor

kderck commented Oct 17, 2023

Hi I've been working on this, However, I believe that it's currently blocked by Unable to pass tfvars file.

@kderck
Copy link
Contributor

kderck commented Nov 22, 2023

Hi I've opened a pull request for this: #285 - Might need a little support with testing

@kderck
Copy link
Contributor

kderck commented Dec 28, 2023

This has been merged @yossigilad and @simar7 . Can this be closed?

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

3 participants