nvkv / tf-unused Goto Github PK
View Code? Open in Web Editor NEWFind unused variables in terraform modules
Find unused variables in terraform modules
If a data
resource is present in the HCL but not attributes from it are used then it could also be removed.
I may be missing something very obvious but I can't make this tool report any unused variables at all.
Basic replication:
variable test {
type = string
}
resource null_resource name {
triggers = {
trigger = value
}
provisioner "local-exec" {
command = "command"
}
}
Running tf-unused displays nothing and returns 0.
Your tool is very useful and I use it a lot. However, I feel like a little feature is missing about tfvars file.
In my project, I have multiple tfvars :
The second one looks like :
my_var = "value"
my_second_var = 5
...
tf-unused
deals very well with variable definitions but not when I assign value to them.
It would be very helpful to add the ability to get a record when a value is assigned to a variable but there isn't a definition for it.
Thanks !
This is great. I suggest making it a pre-commit hook: https://pre-commit.com/.
If not I can fork and do it as well. Just requires a config file and maybe a dockerfile since rust isn't officially supported. Might be able to just grab the binary, not sure.
Edit: I'm converting some other tools like this to pre-commit hooks. I can submit a PR after tinkering a bit.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.