Find unused variables in terraform module.
- Download binary for appropriate platform from releases page.
- Put it somewhere in
$PATH
tf-unused <path-to-tf-module>
When no path specified, tf-unused
will check current directory instead.
If there are unused variables, they will be printed out and process will return non-zero return code.
Otherwise nothing will be printed and process will exit with 0.
% tf-unused tests/fixtures/has_unused/
In tests/fixtures/has_unused/vars.tf:
* Unused definition legacy_switch_i_forgot_to_remove
* Unused definition surprisingly_unimportant_variable
In tests/fixtures/has_unused/some.tfvars:
* Unused value for some_random_variable
% echo $?
1
% tf-unused tests/fixtures/has_no_unused/
% echo $?
0