But I try to init my plugin folder with the following command and never find the modules:
terraform init -plugin-dir ./terraform-plugins
...
...
Initializing the backend...
2022-02-28T16:39:18.639+0100 [DEBUG] New state was assigned lineage "182fcd76-13c9-fce4-25f8-4e31fc6afd98"
2022-02-28T16:39:18.639+0100 [DEBUG] checking for provisioner in "./terraform-plugins"
2022-02-28T16:39:18.639+0100 [DEBUG] init: overriding provider plugin search paths
2022-02-28T16:39:18.639+0100 [DEBUG] will search for provider plugins in [./terraform-plugins]
Initializing provider plugins...
- Finding latest version of hashicorp/aws...
╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/aws: provider registry.terraform.io/hashicorp/aws was not found in any of
│ the search locations
│
│ - ./terraform-plugins
Inside the folder I have the following providers, are the same but with different names, because I’m not sure what is the reason to don’t find the provider by terraform.
tree
.
├── main.tf
└── terraform-plugins
├── terraform-provider-aws
└── terraform-provider-aws_v4.1.0
I using terraform 0.15.3
Can someone help me to define the structure to automatically find by terraform the plugins?
Terraform requires a particular directory structure under a filesystem mirror directory, so that it can use the directory names to understand which provider, version, and platform this executable is intended for.
Packed layout: HOSTNAME/NAMESPACE/TYPE/terraform-provider-TYPE_VERSION_TARGET.zip is the distribution zip file obtained from the provider’s origin registry.
Unpacked layout: HOSTNAME/NAMESPACE/TYPE/VERSION/TARGET is a directory containing the result of extracting the provider’s distribution zip file.
In your case then, your executable file should be placed at the following path, to use the unpacked layout :
The PLATFORM part here will be a string like linux_amd64 specifying the operating system and architecture you’re using Terraform on. You can find out which one you need by running terraform version.
Unfortunately the documentation you linked to seems to be outdated; it’s describing something that would’ve worked for Terraform v0.12 or earlier but hasn’t been valid since Terraform v0.13, which is the first version that supported third-party providers and thus required providers to be identified by a HOSTNAME/NAMESPACE/TYPE address.
Since that bug is in the tutorials, it isn’t directly user editable, but if you file a ticket to the core Terraform repository, I’ll pass it along to the Education team. Thanks!