Speeding up terraform with on nfs/smb shared projects

Recently I had to move my terraform projects into my NAS which is exposed over SMB into my local network. Assume the following network configuration (rough image):

Both the working device, and the NAS device have direct cat 5 1gbps line into the network router.

After moving them I started experiencing an extreme slowdown, where the project if ran on locally accessible storage would complete in 1m11 (measured with time),

[dragas@arch-eriophora cantrill]$ pwd
/home/dragas/IdeaProjects/cantrill
[dragas@arch-eriophora cantrill]$ time terraform apply -auto-approve
...
Apply complete! Resources: 25 added, 0 changed, 0 destroyed.

real    1m11.307s
user    0m7.764s
sys     0m0.525s

while the same project moved to the file share seems to take twice as long.

[dragas@arch-eriophora cantrill]$ pushd /mnt/nasus/proj/IdeaProjects/cantrill/
[dragas@arch-eriophora cantrill]$ time terraform apply -auto-approve
...
Apply complete! Resources: 25 added, 0 changed, 0 destroyed.

real    2m8.868s
user    0m8.088s
sys     0m0.651s

Running the application with TF_LOG=TRACE set, seems to reveal that most of the time is spent on providercache.fillMetaCache.

2025-01-04T17:22:15.666+0200 [DEBUG] ignoring non-existing provider search directory /usr/share/terraform/plugins
2025-01-04T17:22:15.671+0200 [INFO]  CLI command args: []string{"destroy", "-auto-approve"}
2025-01-04T17:22:15.711+0200 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2025-01-04T17:22:15.712+0200 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2025-01-04T17:22:15.712+0200 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend)
2025-01-04T17:22:15.712+0200 [TRACE] Meta.Backend: instantiated backend of type <nil>
2025-01-04T17:22:15.721+0200 [TRACE] providercache.fillMetaCache: scanning directory .terraform/providers
2025-01-04T17:22:15.746+0200 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/aws v5.82.2 for linux_amd64 at .terraform/providers/registry.terraform.io/hashicorp/aws/5.82.2/linux_amd64
2025-01-04T17:22:15.749+0200 [TRACE] providercache.fillMetaCache: including .terraform/providers/registry.terraform.io/hashicorp/aws/5.82.2/linux_amd64 as a candidate package for registry.terraform.io/hashicorp/aws 5.82.2

Can this be moved? I’m seeing TF_DATA_DIR environment variable, but from reading the documentation about it I suspect it’s project specific, and I will need to set it per project I’m deploying.

On unrelated note: why is the provider binary 600mb in size