Terraform 13 provider cache


With Terraform 13 has there been a change around providers and caching?

With version 12, I can initialise using terraform init -plugin-dir … and I can see a plugin_path file adding into my .terraform directory listing the path - no providers copied into the directory I am working from.

With 13 it appears the above is done, however it appears the provider also somehow manages to appear in the .terraform folder for the directory.

Is there a new method for having a single location for providers that is referenced assuming I am missing something?

Will be going up to Terraform 14, so hoping it won’t have changed in there as well


Hi @StevieHyperB,

Terraform v0.13 and greater use the contents of .terraform as the authority for which providers are available for a particular directory, and so -plugin-dir only serves as a backward-compatibility shim for explicit installation method configuration, behaving as if you’d written an a provider_installation block containing only a filesystem_mirror block.

However, when installing from a filesystem mirror Terraform will create symlinks in .terraform where possible, so that the directory structure under there will just contain links to the directories from the provider mirror rather than a deep copy. It will create a deep copy only if it is unable to create a symlink for some reason, such as being on a filesystem where symlinks aren’t supported.

The expected layout of the directory you pass to -plugin-dir is also different from v0.13 onwards, because Terraform now supports multiple namespaces for providers as part of allowing providers written by third parties. As noted above, Terraform treats -plugin-dir as a “filesystem mirror” and so the expected directory structure inside is the one documented under the filesystem_mirror block. Only the “unpacked layout” can produce symlinks as I described above; if you use the “packed” layout (with .zip files) then Terraform will need to extract the archives as part of installation in order to be able to run the program inside.