Loading...
Loading...
### Minimal potential fix This patch works for me but I don't have enough knowledge about Terraform to know if this has some other potential downside. ```diff diff --git internal/providercache/installer.go internal/providercache/installer.go index d375e90ca5..29f4815461 100644 --- internal/providercache/installer.go +++ internal/providercache/installer.go @@ -382,7 +382,7 @@ NeedProvider: // that _does_ match. This might still not work out, but if // it does then it allows us to avoid returning a checksum // mismatch error. - acceptablePackage := false + acceptablePackage := len(preferredHashes) == 0 if len(preferredHashes) != 0 { var err error acceptablePackage, err = cached.MatchesAnyHash(preferredHashes) ``` ### Terraform Version ```shell Terraform v1.14.8 on linux_amd64 ``` ### Terraform Configuration Files $HOME/.terraformrc: ```terraform plugin_cache_dir = "/home/marcus/.terraform.d/plugins" ``` The entire .terraform.d directory contains this at the start: ``` .terraform.d/ ├── checkpoint_cache ├── checkpoint_signature └── plugins ``` The two example Terraform modules have the following structure, contents and semantics. The "one" module uses "local_file" to render file1.tpl into file1.txt, the "two" module uses "local_file" to render file2.tpl into file2.txt. Both modules loads the AWS provider. ``` . ├── file1.tpl ├── file2.tpl ├── one │ ├── main.tf │ └── variables.tf └── two ├── main.tf └── variables.tf ``` one/main.tf and one/variables.tf: ```terraform terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 5.0" } } required_version = ">= 1.2.0" } provider "aws" { region = "eu-north-1" ignore_tags { key_prefixes = ["kubernetes.io"] } } resource "local_file" "template" { content = templatefile("${path.module}/../file1.tpl", { param = var.param }) filename = "${path.module}/../file1.txt" } variable "param" { type = string nullable = false description = "A value" } ``` two/main.tf and two/variables.tf: ```terraform terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 5.0" } } required_version = ">= 1.2.0" } provider "aws" { region = "eu-north-1" ignore_tags { key_prefixes = ["kubernetes.io"] } } resource "local_file" "template" { content = templatefile("${path.module}/../file2.tpl", { param = var.param }) filename = "${path.module}/../file2.txt" } variable "param" { type = string nullable = false description = "A value" } ``` ### Debug Output The first terraform init works fine: ``` cd one TF_LOG=TRACE terraform init 2026-04-11T14:25:42.324+0200 [INFO] Terraform version: 1.14.8 2026-04-11T14:25:42.324+0200 [DEBUG] using github.com/hashicorp/go-tfe v1.94.0 2026-04-11T14:25:42.324+0200 [DEBUG] using github.com/hashicorp/hcl/v2 v2.24.0 2026-04-11T14:25:42.324+0200 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1 2026-04-11T14:25:42.324+0200 [DEBUG] using github.com/zclconf/go-cty v1.16.3 2026-04-11T14:25:42.324+0200 [INFO] Go runtime version: go1.25.8 2026-04-11T14:25:42.324+0200 [INFO] CLI args: []string{"terraform", "init"} 2026-04-11T14:25:42.324+0200 [TRACE] Stdout is a terminal of width 238 2026-04-11T14:25:42.324+0200 [TRACE] Stderr is a terminal of width 238 2026-04-11T14:25:42.324+0200 [TRACE] Stdin is a terminal 2026-04-11T14:25:42.324+0200 [DEBUG] Attempting to open CLI config file: /home/marcus/.terraformrc 2026-04-11T14:25:42.324+0200 [INFO] Loading CLI configuration from /home/marcus/.terraformrc 2026-04-11T14:25:42.324+0200 [DEBUG] checking for credentials in "/home/marcus/.terraform.d/plugins" 2026-04-11T14:25:42.324+0200 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins 2026-04-11T14:25:42.324+0200 [DEBUG] will search for provider plugins in /home/marcus/.terraform.d/plugins 2026-04-11T14:25:42.324+0200 [DEBUG] ignoring non-existing provider search directory /home/marcus/.local/share/terraform/plugins 2026-04-11T14:25:42.324+0200 [DEBUG] ignoring non-existing provider search directory /home/marcus/.local/share/flatpak/exports/share/terraform/plugins 2026-04-11T14:25:42.324+0200 [DEBUG] ignoring non-existing provider search directory /var/lib/flatpak/exports/share/terraform/plugins 2026-04-11T14:25:42.324+0200 [DEBUG] ignoring non-existing provider search directory /usr/local/share/terraform/plugins 2026-04-11T14:25:42.324+0200 [DEBUG] ignoring non-existing provider search directory /usr/share/terraform/plugins 2026-04-11T14:25:42.324+0200 [DEBUG] ignoring non-existing provider search directory /var/lib/snapd/desktop/terraform/plugins 2026-04-11T14:25:42.325+0200 [INFO] CLI command args: []string{"init"} Initializing the backend... 2026-04-11T14:25:42.326+0200 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config 2026-04-11T14:25:42.326+0200 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory 2026-04-11T14:25:42.326+0200 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend) 2026-04-11T14:25:42.326+0200 [TRACE] Meta.Backend: instantiated backend of type 2026-04-11T14:25:42.328+0200 [TRACE] providercache.fillMetaCache: scanning directory .terraform/providers 2026-04-11T14:25:42.328+0200 [TRACE] getproviders.SearchLocalDirectory: failed to resolve symlinks for .terraform/providers: lstat .terraform: no such file or directory 2026-04-11T14:25:42.328+0200 [TRACE] providercache.fillMetaCache: error while scanning directory .terraform/providers: cannot search .terraform/providers: lstat .terraform/providers: no such file or directory 2026-04-11T14:25:42.328+0200 [TRACE] providercache.fillMetaCache: scanning directory .terraform/providers 2026-04-11T14:25:42.328+0200 [TRACE] getproviders.SearchLocalDirectory: failed to resolve symlinks for .terraform/providers: lstat .terraform: no such file or directory 2026-04-11T14:25:42.328+0200 [TRACE] providercache.fillMetaCache: error while scanning directory .terraform/providers: cannot search .terraform/providers: lstat .terraform/providers: no such file or directory 2026-04-11T14:25:42.328+0200 [DEBUG] checking for provisioner in "." 2026-04-11T14:25:42.328+0200 [DEBUG] checking for provisioner in "/usr/local/bin" 2026-04-11T14:25:42.328+0200 [DEBUG] checking for provisioner in "/home/marcus/.terraform.d/plugins" 2026-04-11T14:25:42.328+0200 [TRACE] Meta.Backend: backend does not support operations, so wrapping it in a local backend 2026-04-11T14:25:42.328+0200 [TRACE] backend/local: state manager for workspace "default" will: - read initial snapshot from terraform.tfstate - write new snapshots to terraform.tfstate - create any backup at terraform.tfstate.backup 2026-04-11T14:25:42.328+0200 [TRACE] statemgr.Filesystem: reading initial snapshot from terraform.tfstate 2026-04-11T14:25:42.328+0200 [TRACE] statemgr.Filesystem: snapshot file has nil snapshot, but that's okay 2026-04-11T14:25:42.328+0200 [TRACE] statemgr.Filesystem: read nil snapshot Initializing provider plugins... - Reusing previous version of hashicorp/aws from the dependency lock file 2026-04-11T14:25:42.331+0200 [DEBUG] Service discovery for registry.terraform.io at https://registry.terraform.io/.well-known/terraform.json 2026-04-11T14:25:42.331+0200 [TRACE] HTTP client GET request to https://registry.terraform.io/.well-known/terraform.json 2026-04-11T14:25:42.513+0200 [DEBUG] GET https://registry.terraform.io/v1/providers/hashicorp/aws/versions 2026-04-11T14:25:42.513+0200 [TRACE] HTTP client GET request to https://registry.terraform.io/v1/providers/hashicorp/aws/versions - Reusing previous version of hashicorp/local from the dependency lock file 2026-04-11T14:25:42.586+0200 [DEBUG] GET https://registry.terraform.io/v1/providers/hashicorp/local/versions 2026-04-11T14:25:42.586+0200 [TRACE] HTTP client GET request to https://registry.terraform.io/v1/providers/hashicorp/local/versions 2026-04-11T14:25:42.909+0200 [TRACE] providercache.fillMetaCache: scanning directory .terraform/providers 2026-04-11T14:25:42.909+0200 [TRACE] getproviders.SearchLocalDirectory: failed to resolve symlinks for .terraform/providers: lstat .terraform: no such file or directory 2026-04-11T14:25:42.909+0200 [TRACE] providercache.fillMetaCache: error while scanning directory .terraform/providers: cannot search .terraform/providers: lstat .terraform/providers: no such file or directory 2026-04-11T14:25:42.909+0200 [TRACE] providercache.fillMetaCache: scanning directory /home/marcus/.terraform.d/plugins 2026-04-11T14:25:42.910+0200 [DEBUG] GET https://registry.terraform.io/v1/providers/hashicorp/aws/5.100.0/download/linux/amd64 2026-04-11T14:25:42.910+0200 [TRACE] HTTP client GET request to https://registry.terraform.io/v1/providers/hashicorp/aws/5.100.0/download/linux/amd64 2026-04-11T14:25:42.966+0200 [DEBUG] GET https://releases.hashicorp.com/terraform-provider-aws/5.100.0/terraform-provider-aws_5.100.0_SHA256SUMS 2026-04-11T14:25:42.966+0200 [TRACE] HTTP client GET request to https://releases.hashicorp.com/terraform-provider-aws/5.100.0/terraform-provider-aws_5.100.0_SHA256SUMS 2026-04-11T14:25:43.130+0200 [DEBUG] GET https://releases.hashicorp.com/terraform-provider-aws/5.100.0/terraform-provider-aws_5.100.0_SHA256SUMS.72D7468F.sig 2026-04-11T14:25:43.130+0200 [TRACE] HTTP client GET request to https://releases.hashicorp.com/terraform-provider-aws/5.100.0/terraform-provider-aws_5.100.0_SHA256SUMS.72D7468F.sig - Installing hashicorp/aws v5.100.0... 2026-04-11T14:25:43.200+0200 [TRACE] providercache.Dir.InstallPackage: installing registry.terraform.io/hashicorp/aws v5.100.0 from https://releases.hashicorp.com/terraform-provider-aws/5.100.0/terraform-provider-aws_5.100.0_linux_amd64.zip 2026-04-11T14:25:43.200+0200 [TRACE] HTTP client GET request to https://releases.hashicorp.com/terraform-provider-aws/5.100.0/terraform-provider-aws_5.100.0_linux_amd64.zip 2026-04-11T14:27:33.503+0200 [DEBUG] Provider signed by 34365D9472D7468F HashiCorp Security (hashicorp.com/security) 2026-04-11T14:27:41.571+0200 [TRACE] providercache.fillMetaCache: scanning directory /home/marcus/.terraform.d/plugins 2026-04-11T14:27:41.571+0200 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/aws v5.100.0 for linux_amd64 at /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 2026-04-11T14:27:41.571+0200 [TRACE] providercache.fillMetaCache: including /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 as a candidate package for registry.terraform.io/hashicorp/aws 5.100.0 2026-04-11T14:27:41.571+0200 [TRACE] providercache.Dir.LinkFromOtherCache: linking registry.terraform.io/hashicorp/aws v5.100.0 from existing cache /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 to .terraform/providers/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 2026-04-11T14:27:41.571+0200 [TRACE] providercache.fillMetaCache: scanning directory .terraform/providers 2026-04-11T14:27:41.571+0200 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/aws v5.100.0 for linux_amd64 at .terraform/providers/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 2026-04-11T14:27:41.571+0200 [TRACE] providercache.fillMetaCache: including .terraform/providers/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 as a candidate package for registry.terraform.io/hashicorp/aws 5.100.0 - Installed hashicorp/aws v5.100.0 (signed by HashiCorp) 2026-04-11T14:27:42.385+0200 [TRACE] providercache.fillMetaCache: using cached result from previous scan of .terraform/providers 2026-04-11T14:27:42.385+0200 [TRACE] providercache.fillMetaCache: using cached result from previous scan of /home/marcus/.terraform.d/plugins 2026-04-11T14:27:42.385+0200 [DEBUG] GET https://registry.terraform.io/v1/providers/hashicorp/local/2.8.0/download/linux/amd64 2026-04-11T14:27:42.385+0200 [TRACE] HTTP client GET request to https://registry.terraform.io/v1/providers/hashicorp/local/2.8.0/download/linux/amd64 2026-04-11T14:27:42.550+0200 [DEBUG] GET https://releases.hashicorp.com/terraform-provider-local/2.8.0/terraform-provider-local_2.8.0_SHA256SUMS 2026-04-11T14:27:42.550+0200 [TRACE] HTTP client GET request to https://releases.hashicorp.com/terraform-provider-local/2.8.0/terraform-provider-local_2.8.0_SHA256SUMS 2026-04-11T14:27:42.686+0200 [DEBUG] GET https://releases.hashicorp.com/terraform-provider-local/2.8.0/terraform-provider-local_2.8.0_SHA256SUMS.72D7468F.sig 2026-04-11T14:27:42.686+0200 [TRACE] HTTP client GET request to https://releases.hashicorp.com/terraform-provider-local/2.8.0/terraform-provider-local_2.8.0_SHA256SUMS.72D7468F.sig - Installing hashicorp/local v2.8.0... 2026-04-11T14:27:42.755+0200 [TRACE] providercache.Dir.InstallPackage: installing registry.terraform.io/hashicorp/local v2.8.0 from https://releases.hashicorp.com/terraform-provider-local/2.8.0/terraform-provider-local_2.8.0_linux_amd64.zip 2026-04-11T14:27:42.756+0200 [TRACE] HTTP client GET request to https://releases.hashicorp.com/terraform-provider-local/2.8.0/terraform-provider-local_2.8.0_linux_amd64.zip 2026-04-11T14:27:48.524+0200 [DEBUG] Provider signed by 34365D9472D7468F HashiCorp Security (hashicorp.com/security) 2026-04-11T14:27:48.871+0200 [TRACE] providercache.fillMetaCache: scanning directory /home/marcus/.terraform.d/plugins 2026-04-11T14:27:48.871+0200 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/aws v5.100.0 for linux_amd64 at /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 2026-04-11T14:27:48.871+0200 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/local v2.8.0 for linux_amd64 at /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/local/2.8.0/linux_amd64 2026-04-11T14:27:48.871+0200 [TRACE] providercache.fillMetaCache: including /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 as a candidate package for registry.terraform.io/hashicorp/aws 5.100.0 2026-04-11T14:27:48.871+0200 [TRACE] providercache.fillMetaCache: including /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/local/2.8.0/linux_amd64 as a candidate package for registry.terraform.io/hashicorp/local 2.8.0 2026-04-11T14:27:48.871+0200 [TRACE] providercache.Dir.LinkFromOtherCache: linking registry.terraform.io/hashicorp/local v2.8.0 from existing cache /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/local/2.8.0/linux_amd64 to .terraform/providers/registry.terraform.io/hashicorp/local/2.8.0/linux_amd64 2026-04-11T14:27:48.872+0200 [TRACE] providercache.fillMetaCache: scanning directory .terraform/providers 2026-04-11T14:27:48.872+0200 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/aws v5.100.0 for linux_amd64 at .terraform/providers/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 2026-04-11T14:27:48.872+0200 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/local v2.8.0 for linux_amd64 at .terraform/providers/registry.terraform.io/hashicorp/local/2.8.0/linux_amd64 2026-04-11T14:27:48.872+0200 [TRACE] providercache.fillMetaCache: including .terraform/providers/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 as a candidate package for registry.terraform.io/hashicorp/aws 5.100.0 2026-04-11T14:27:48.872+0200 [TRACE] providercache.fillMetaCache: including .terraform/providers/registry.terraform.io/hashicorp/local/2.8.0/linux_amd64 as a candidate package for registry.terraform.io/hashicorp/local 2.8.0 - Installed hashicorp/local v2.8.0 (signed by HashiCorp) Terraform has been successfully initialized! You may now begin working with Terraform. Try running "terraform plan" to see any changes that are required for your infrastructure. All Terraform commands should now work. If you ever set or change modules or backend configuration for Terraform, rerun this command to reinitialize your working directory. If you forget, other commands will detect it and remind you to do so if necessary. ``` But terraform init on the second module fails and requires deletion of everything in the plugin_cache_dir to work ``` cd ../two TF_LOG=TRACE terraform init 2026-04-11T14:28:38.882+0200 [INFO] Terraform version: 1.14.8 2026-04-11T14:28:38.882+0200 [DEBUG] using github.com/hashicorp/go-tfe v1.94.0 2026-04-11T14:28:38.882+0200 [DEBUG] using github.com/hashicorp/hcl/v2 v2.24.0 2026-04-11T14:28:38.882+0200 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1 2026-04-11T14:28:38.882+0200 [DEBUG] using github.com/zclconf/go-cty v1.16.3 2026-04-11T14:28:38.882+0200 [INFO] Go runtime version: go1.25.8 2026-04-11T14:28:38.882+0200 [INFO] CLI args: []string{"terraform", "init"} 2026-04-11T14:28:38.882+0200 [TRACE] Stdout is a terminal of width 238 2026-04-11T14:28:38.882+0200 [TRACE] Stderr is a terminal of width 238 2026-04-11T14:28:38.882+0200 [TRACE] Stdin is a terminal 2026-04-11T14:28:38.882+0200 [DEBUG] Attempting to open CLI config file: /home/marcus/.terraformrc 2026-04-11T14:28:38.882+0200 [INFO] Loading CLI configuration from /home/marcus/.terraformrc 2026-04-11T14:28:38.883+0200 [DEBUG] checking for credentials in "/home/marcus/.terraform.d/plugins" 2026-04-11T14:28:38.883+0200 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins 2026-04-11T14:28:38.883+0200 [DEBUG] will search for provider plugins in /home/marcus/.terraform.d/plugins 2026-04-11T14:28:38.883+0200 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/aws v5.100.0 for linux_amd64 at /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 2026-04-11T14:28:38.883+0200 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/local v2.8.0 for linux_amd64 at /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/local/2.8.0/linux_amd64 2026-04-11T14:28:38.883+0200 [DEBUG] ignoring non-existing provider search directory /home/marcus/.local/share/terraform/plugins 2026-04-11T14:28:38.883+0200 [DEBUG] ignoring non-existing provider search directory /home/marcus/.local/share/flatpak/exports/share/terraform/plugins 2026-04-11T14:28:38.883+0200 [DEBUG] ignoring non-existing provider search directory /var/lib/flatpak/exports/share/terraform/plugins 2026-04-11T14:28:38.883+0200 [DEBUG] ignoring non-existing provider search directory /usr/local/share/terraform/plugins 2026-04-11T14:28:38.883+0200 [DEBUG] ignoring non-existing provider search directory /usr/share/terraform/plugins 2026-04-11T14:28:38.883+0200 [DEBUG] ignoring non-existing provider search directory /var/lib/snapd/desktop/terraform/plugins 2026-04-11T14:28:38.884+0200 [INFO] CLI command args: []string{"init"} Initializing the backend... 2026-04-11T14:28:38.885+0200 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config 2026-04-11T14:28:38.885+0200 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory 2026-04-11T14:28:38.885+0200 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend) 2026-04-11T14:28:38.885+0200 [TRACE] Meta.Backend: instantiated backend of type 2026-04-11T14:28:38.885+0200 [DEBUG] checking for provisioner in "." 2026-04-11T14:28:38.885+0200 [DEBUG] checking for provisioner in "/usr/local/bin" 2026-04-11T14:28:38.885+0200 [DEBUG] checking for provisioner in "/home/marcus/.terraform.d/plugins" 2026-04-11T14:28:38.885+0200 [TRACE] Meta.Backend: backend does not support operations, so wrapping it in a local backend 2026-04-11T14:28:38.885+0200 [TRACE] backend/local: state manager for workspace "default" will: - read initial snapshot from terraform.tfstate - write new snapshots to terraform.tfstate - create any backup at terraform.tfstate.backup 2026-04-11T14:28:38.885+0200 [TRACE] statemgr.Filesystem: reading initial snapshot from terraform.tfstate 2026-04-11T14:28:38.885+0200 [TRACE] statemgr.Filesystem: snapshot file has nil snapshot, but that's okay 2026-04-11T14:28:38.885+0200 [TRACE] statemgr.Filesystem: read nil snapshot Initializing provider plugins... - Finding latest version of hashicorp/local... - Finding hashicorp/aws versions matching "~> 5.0"... 2026-04-11T14:28:38.886+0200 [TRACE] providercache.fillMetaCache: scanning directory .terraform/providers 2026-04-11T14:28:38.886+0200 [TRACE] getproviders.SearchLocalDirectory: failed to resolve symlinks for .terraform/providers: lstat .terraform: no such file or directory 2026-04-11T14:28:38.886+0200 [TRACE] providercache.fillMetaCache: error while scanning directory .terraform/providers: cannot search .terraform/providers: lstat .terraform/providers: no such file or directory 2026-04-11T14:28:38.886+0200 [TRACE] providercache.fillMetaCache: scanning directory /home/marcus/.terraform.d/plugins 2026-04-11T14:28:38.886+0200 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/aws v5.100.0 for linux_amd64 at /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 2026-04-11T14:28:38.886+0200 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/local v2.8.0 for linux_amd64 at /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/local/2.8.0/linux_amd64 2026-04-11T14:28:38.886+0200 [TRACE] providercache.fillMetaCache: including /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 as a candidate package for registry.terraform.io/hashicorp/aws 5.100.0 2026-04-11T14:28:38.886+0200 [TRACE] providercache.fillMetaCache: including /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/local/2.8.0/linux_amd64 as a candidate package for registry.terraform.io/hashicorp/local 2.8.0 - Installing hashicorp/local v2.8.0... 2026-04-11T14:28:38.886+0200 [TRACE] providercache.Dir.InstallPackage: installing registry.terraform.io/hashicorp/local v2.8.0 from /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/local/2.8.0/linux_amd64 2026-04-11T14:28:38.886+0200 [TRACE] providercache.fillMetaCache: scanning directory .terraform/providers 2026-04-11T14:28:38.886+0200 [TRACE] getproviders.SearchLocalDirectory: failed to resolve symlinks for .terraform/providers: lstat .terraform: no such file or directory 2026-04-11T14:28:38.886+0200 [TRACE] providercache.fillMetaCache: error while scanning directory .terraform/providers: cannot search .terraform/providers: lstat .terraform/providers: no such file or directory 2026-04-11T14:28:38.886+0200 [TRACE] providercache.fillMetaCache: scanning directory /home/marcus/.terraform.d/plugins 2026-04-11T14:28:38.886+0200 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/aws v5.100.0 for linux_amd64 at /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 2026-04-11T14:28:38.886+0200 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/local v2.8.0 for linux_amd64 at /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/local/2.8.0/linux_amd64 2026-04-11T14:28:38.886+0200 [TRACE] providercache.fillMetaCache: including /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/local/2.8.0/linux_amd64 as a candidate package for registry.terraform.io/hashicorp/local 2.8.0 2026-04-11T14:28:38.886+0200 [TRACE] providercache.fillMetaCache: including /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 as a candidate package for registry.terraform.io/hashicorp/aws 5.100.0 - Installing hashicorp/aws v5.100.0... 2026-04-11T14:28:38.886+0200 [TRACE] providercache.Dir.InstallPackage: installing registry.terraform.io/hashicorp/aws v5.100.0 from /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 ╷ │ Error: Failed to install provider │ │ Error while installing hashicorp/local v2.8.0: cannot install existing provider directory /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/local/2.8.0/linux_amd64 to itself ╵ ╷ │ Error: Failed to install provider │ │ Error while installing hashicorp/aws v5.100.0: cannot install existing provider directory /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 to itself ╵ ``` All of these also fail with the same error when run on the second module: ``` terraform init -upgrade terraform init -reconfigure terraform init -migrate-state ``` ### Expected Behavior - terraform init should work regardless of how many modules it is run on, i.e. it should not only work the first time - terraform init should be able to reuse the plugins from the plugin_cache_dir without it having to redownload the plugins for every module - plugin_cache_dir should be possible to share among multiple modules ### Actual Behavior Once the modules have been downloaded subsequent Terraform modules cannot be initialized with terraform init unless the contents of the plugin_cache_dir is deleted. ### Steps to Reproduce See "Terraform configuration" and "Debug output" examples for details but basically: 1. cd one ; terraform init 2. cd ../two ; terraform init The first one works, the second one fails with errors: ``` ╷ │ Error: Failed to install provider │ │ Error while installing hashicorp/local v2.8.0: cannot install existing provider directory /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/local/2.8.0/linux_amd64 to itself ╵ ╷ │ Error: Failed to install provider │ │ Error while installing hashicorp/aws v5.100.0: cannot install existing provider directory /home/marcus/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/5.100.0/linux_amd64 to itself ╵ ``` ### Additional Context _No response_ ### References _No response_ ### Generative AI / LLM assisted development? _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.