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

feat(config): use spf13/viper to read config from env vars #1990

Merged
merged 1 commit into from Mar 17, 2023

Conversation

nitrocode
Copy link
Contributor

@nitrocode nitrocode commented Feb 16, 2023

what

  • use spf13/viper to read config from env vars

why

  • This will allow configuring settings using TFSEC_ prefix e.g. TFSEC_VERBOSE=true, TFSEC_SOFT_FAIL=true, etc
  • This uses spf13/viper (created by the same author as spf13/cobra) and it integrates seamlessly here

references

commands

Build

$ asdf install go 1.18
$ asdf local go 1.18
$ go mod tidy
$ go get github.com/spf13/viper
$ go get github.com/spf13/pflag
$ make build

Run

$ ./bin/darwin/tfsec-darwin-amd64
...

  14 passed, 2 ignored, 13 potential problem(s) detected.

$ echo $?
1

$ TFSEC_SOFT_FAIL=true ./bin/darwin/tfsec-darwin-amd64
...

 14 passed, 2 ignored, 13 potential problem(s) detected.

$ echo $?
0

@nitrocode
Copy link
Contributor Author

Friendly ping @owenrumney

@nitrocode
Copy link
Contributor Author

Friendly ping @itaysk

@nitrocode
Copy link
Contributor Author

Friendly ping @owenrumney @itaysk

@itaysk
Copy link

itaysk commented Mar 2, 2023

@nitrocode thank you very much for taking the time to contribute.
As we shared before, we are focusing our attention from tfsec to Trivy (which has the same terraform scanning capability). Read more about this here: https://github.com/aquasecurity/tfsec/discussions/1994

@nitrocode
Copy link
Contributor Author

Does this mean that this PR will not be reviewed or merged since you folks are trying to deprecate tfsec in favor of trivy ?

Is it possible that this PR can be the last one merged before the full deprecation? 🙏

@simar7
Copy link
Member

simar7 commented Mar 17, 2023

hi @nitrocode could you rebase this PR on the latest master branch of tfsec and make sure the tests pass? We're trying to merge all outstanding PRs for tfsec at the moment.

@nitrocode nitrocode force-pushed the configure-tfsec-with-env-vars branch from d92aef9 to 7d633ec Compare March 17, 2023 04:21
@nitrocode nitrocode force-pushed the configure-tfsec-with-env-vars branch from 7d633ec to 09b1628 Compare March 17, 2023 04:33
@nitrocode
Copy link
Contributor Author

@simar7 I rebased and fixed the linting issue locally. I verified using make quality.

@simar7 simar7 requested review from simar7 and removed request for owenrumney March 17, 2023 05:02
@simar7 simar7 merged commit fbca933 into aquasecurity:master Mar 17, 2023
5 checks passed
@nitrocode nitrocode deleted the configure-tfsec-with-env-vars branch March 17, 2023 05:07
@nitrocode
Copy link
Contributor Author

@simar7 could we get an official release for this pr merge? I'd love to start using this feature in my pipeline.

@nitrocode
Copy link
Contributor Author

Friendly ping @simar7 @AnaisUrlichs @itaysk. Could you folks release a final version of v1.28.2 or v1.29.0 please?

@simar7
Copy link
Member

simar7 commented Jun 3, 2023

Friendly ping @simar7 @AnaisUrlichs @itaysk. Could you folks release a final version of v1.28.2 or v1.29.0 please?

Hi, at the moment we can't promise a definite date on getting the next release but I will circle back on this next week to see if I can spend some cycles to move it forward. Thanks for your patience.

@nitrocode
Copy link
Contributor Author

Friendly ping when you folks get a chance. 😄

Have a nice weekend!

@nitrocode
Copy link
Contributor Author

Friendly ping (hope it doesn't seem like nagging, just very excited for this release) @simar7 and all 😁🙏🏽

@nitrocode
Copy link
Contributor Author

Friendly ping @simar7 ! Hope this is OK every once in a while 😄

@nitrocode
Copy link
Contributor Author

Friendly ping all @simar7 @AnaisUrlichs @itaysk ! Hope you folks are doing OK. Have a nice weekend. Looking forward to the next release! 🚀 🙏

@nitrocode
Copy link
Contributor Author

Thank you! You guys are awesome!

Released in v1.28.2

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