terraform
terraform copied to clipboard
-enable-plugin-cache flag not functioning
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
export TF_PLUGIN_CACHE_DIR="$HOME/.terraform.d/plugin-cache"terraform initterraform providers lock -enable-plugin-cache
Additional Context
No response
References
https://github.com/hashicorp/terraform/pull/34632
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.