Terraform resource diffs for identifying unused attributes and parameters.
In my limited free time, I enjoy maintaining community Terraform modules.
Digging through the Terraform Registry documentation and switching between the
browser and terminal can be tedious, so I built tfrd to compare the resources
in a Terraform configuration with the provider schema and report unused
attributes and parameters. As a community contributor, I want my modules to
reflect the full range of functionality providers support, and this tool helps
me find gaps.
If you manage packages with brew, you can use this repository's tap to install with:
brew tap RoseSecurity/tfrd https://github.com/RoseSecurity/tfrd
brew trust --formula rosesecurity/tfrd/tfrd
brew install tfrdIf you have a functional Go environment, you can install with:
go install github.com/RoseSecurity/tfrd@latestTo install packages, you can quickly setup the repository automatically:
curl -1sLf \
'https://dl.cloudsmith.io/public/rosesecurity/tfrd/setup.deb.sh' \
| sudo -E bashOnce the repository is configured, you can install with:
apt install tfrdgit clone https://github.com/RoseSecurity/tfrd.git
cd tfrd
make buildRun tfrd from an initialized Terraform directory, or pass the directory as an
argument. Use --init to run terraform init -backend=false automatically
before loading the provider schema:
tfrd
tfrd ./examples
tfrd --init ./examplesBy default, tfrd analyzes .tf files directly inside the selected directory.
Use --file to analyze one file, --resource to filter by resource type or
address, and --json for machine-readable output:
tfrd --file ./examples/main.tf ./examples
tfrd --resource local_file ./examples
tfrd --json ./examplesRead-only computed attributes are excluded by default. Add
--include-computed to include them in the report.
Add --include-descriptions to include provider-supplied descriptions for
unused attributes in text and JSON output.
Run tfrd --help for all available options.
Bug reports and feature requests are welcome in the issue tracker. Pull requests are welcome; please fork the repository, make your changes on a branch, and open a pull request.
