-
Notifications
You must be signed in to change notification settings - Fork 10.3k
terraform-bundle tool only finds provider from .plugins/ directory. Error: ...no provider exists with the given name #24506
Description
I am trying to use the terraform-bundle tool to bundle a custom provider to use with TFE. The terraform-bundle tool kept failing to find the provider in the standard Terraform plugin discovery locations. The only place that it worked is in the ./plugins directory. If this is by design, please consider making it explicit. Full reproduce steps below.
Terraform Version
terraform --version
Terraform v0.12.20
$ terraform-bundle --version
0.13.0
$ uname -a
Linux ip-10-0-1-243 4.4.0-1075-aws #85-Ubuntu SMP Thu Jan 17 17:15:12 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Terraform Configuration Files
N/ADebug Output
Crash Output
Expected Behavior
Per terraform-bundle documentation, the terraform-bundle tool should detect a custom or community provider from any of the locations listed here Plugin Locations
Actual Behavior
The terraform-bundle tool only detected a custom/community plugin from the ./plugins directory.
Steps to Reproduce
In the steps below I attempt to download the aws, google provider, and a community provider called shell. The only plugin location that works for shell is ./plugins. If I put the provider in a standard Plugin Location, I get the error: Failed to resolve shell provider 1.0.0: no provider exists with the given name
# Start a working directory
mkdir -p ~/build && cd ~/build
# Clear existing plugin locations
rm -rf "$HOME/.terraform" "$HOME/.terraform.d" .terraform.d/ .plugins
plugin_loc=".plugins" # <--- this is the only location that works
#plugin_loc="$HOME/.terraform.d/plugins/linux_amd64"
#plugin_loc="$HOME/.terraform.d/plugins"
#plugin_loc="$HOME/.terraform/plugins"
#plugin_loc=".terraform.d/plugins/linux_amd64"
mkdir -p $plugin_loc
# Download community plugin
wget https://github.com/scottwinkler/terraform-provider-shell/releases/download/v1.0.0/terraform-provider-shell_v1.0.0.linux_amd64 -O $plugin_loc/terraform-provider-shell_v1.0.0
chmod +rx -R $plugin_loc/
# Write a terraform-bundle.hcl file
cat <<EOF>terraform-bundle.hcl
terraform {
# Version of Terraform to include in the bundle. An exact version number
# is required.
version = "0.12.20"
}
# Define which provider plugins are to be included
providers {
# Include the newest "aws" provider version in the 1.0 series.
aws = ["~> 2.0"]
# Include both the newest 1.0 and 2.0 versions of the "google" provider.
# Each item in these lists allows a distinct version to be added. If the
# two expressions match different versions then _both_ are included in
# the bundle archive.
google = ["~> 3.0"]
# Include a custom plugin to the bundle. Will search for the plugin in the
# plugins directory, and package it with the bundle archive. Plugin must have
# a name of the form: terraform-provider-*, and must be build with the operating
# system and architecture that terraform enterprise is running, e.g. linux and amd64
shell = ["1.0.0"]
}
EOF
terraform-bundle package -os=linux -arch=amd64 terraform-bundle.hcl