terraform icon indicating copy to clipboard operation
terraform copied to clipboard

-enable-plugin-cache flag not functioning

Open lijok opened this issue 1 year ago • 1 comments

Terraform Version

Terraform v1.8.4
on darwin_arm64

Terraform Configuration Files

terraform {
  required_version = "= 1.8.4"

  required_providers {
    aws = {
      source  = "registry.terraform.io/hashicorp/aws"
      version = "= 5.52.0"
    }

  backend "local" {}
}

Debug Output

N/A

Expected Behavior

Plugins should be fetched from cache

Actual Behavior

Plugins are being fetched from remote

Steps to Reproduce

  1. export TF_PLUGIN_CACHE_DIR="$HOME/.terraform.d/plugin-cache"
  2. terraform init
  3. terraform providers lock -enable-plugin-cache

Additional Context

No response

References

https://github.com/hashicorp/terraform/pull/34632

lijok avatar May 31 '24 09:05 lijok

Hi @lijok,

Thanks for filing the issue. The providers lock command can't create a complete lock file from the cache, since it does not contain the hashes for all architectures, so it's not clear how you would use -enable-plugin-cache if the lock file can't be generated. I'm not sure exactly what was intended with the referenced PR, but also setting TF_PLUGIN_CACHE_MAY_BREAK_DEPENDENCY_LOCK_FILE=true should allow the creation of a lock file only containing the cached binary, which is what I assume you're trying to do.

jbardin avatar Jun 17 '24 17:06 jbardin