tfmask
tfmask copied to clipboard
Supported Colors and Terraform 12 JSON diff secrets masking
Credit to @1n for figuring out a way of stripping ANSI colours and diffing.
We are using this project with terraform-provider-helmfile. It tends to generate big diffs with JSON and YAML files pretty printed and we sometimes see secrets leaking to the screen.
To support masking these cases we decided to just detect secrets with regex on ANSI-stripped terraform output and saving them to a new genericMatch structure.
It contains a list of confidential strings, that are then masked in ANSI-colored output before we print it out to the screen.
The whole codebase can be adapted to this approach, however due to time constraints, I was unable to do so.
This looks great!
Ugh, looks like when I wrote the github action I forgot to actually run the tests. :/
Any chance you can add that? Otherwise, I'll have @aknysh take a look.
Hey @osterman, I'm super swamped with deployments right now. Happy to review though.
@mnatan thanks for the PR, please rebase
@aknysh rebased
This is really useful when using with Helmfile provider. Would be good if it can be merged soon if it looks good 👍