hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io
Other
42.81k stars 9.57k forks source link

Place a CACHEDIR.TAG in .terraform/providers/ #36007

Open ogarcia opened 1 week ago

ogarcia commented 1 week ago

Terraform Version

Terraform v1.9.8

Use Cases

Currently terraform downloads the providers and installs them in the .terraform/providers/ directory, these providers can be downloaded again so it would be interesting to indicate to the system that this directory is really a cache.

Attempted Solutions

Doing this is proposed manually, but you do not always remember.

Proposal

Automatically create a CACHEDIR.TAG file either globally in .terraform/providers/ or for each downloaded provider. This file must contain the following:

Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by terraform.
# For information about cache directory tags see https://bford.info/cachedir/

In this way the backup systems do not back up this directory when they find this file.

This method is used for example by cargo (Rust) in the target directory for what is described in the previous paragraph.

References

No response

crw commented 3 days ago

Thanks for this feature request! If you are viewing this issue and would like to indicate your interest, please use the 👍 reaction on the issue description to upvote this issue. We also welcome additional use case descriptions. Thanks again!