Reputation: 3256
To run Terraform for IBM Cloud we need to download a module: Module
Is there a way to place this module on central server which anyone who wants to run terraform calls. So anyone using it can access it rather than downloading it each time on their local machine to run terraform?
Upvotes: 0
Views: 69
Reputation: 2185
terraform init -verify-plugins=false -plugin-dir=${SCRIPT_DIR}/plugins
#!/usr/bin/env bash
os=$([[ $(uname) == "Darwin" ]] && echo "darwin" || echo "linux")
plugins=$(echo -e "
terraform-provider-aws/1.51.0/terraform-provider-aws_1.51.0_${os}_amd64.zip
terraform-provider-archive/1.1.0/terraform-provider-archive_1.1.0_${os}_amd64.zip
terraform-provider-external/1.0.0/terraform-provider-external_1.0.0_${os}_amd64.zip
terraform-provider-local/1.1.0/terraform-provider-local_1.1.0_${os}_amd64.zip
terraform-provider-null/1.0.0/terraform-provider-null_1.0.0_${os}_amd64.zip
terraform-provider-random/2.0.0/terraform-provider-random_2.0.0_${os}_amd64.zip
terraform-provider-template/1.0.0/terraform-provider-template_1.0.0_${os}_amd64.zip
terraform-provider-terraform/1.0.2/terraform-provider-terraform_1.0.2_${os}_amd64.zip
terraform-provider-tls/1.2.0/terraform-provider-tls_1.2.0_${os}_amd64.zip
" | xargs )
for plugin in `echo $plugins`; do
name=$(echo $plugin | cut -d'/' -f3 | cut -d'_' -f1)
version=$(echo "$plugin" | cut -d'/' -f3 | cut -d'_' -f2)
plug="${name}_v${version}_x4"
if [ ! -f "$SCRIPT_DIR/plugins/$plug" ]; then
wget -q $SCRIPT_DIR/plugins https://releases.hashicorp.com/$plugin -O plugin.zip
unzip -q ./plugin.zip -d $SCRIPT_DIR/plugins
rm -rf ./plugin.zip
fi
done
Upvotes: 0