Skip to content
/ tpm Public

🛠️ A package manager for Terraform providers

License

Notifications You must be signed in to change notification settings

Madh93/tpm

Repository files navigation

Terraform Provider Manager

MIT license

Terraform Provider Manager (tpm) is a command-line interface (CLI) tool designed to simplify the management of Terraform providers in the plugin cache directory. With tpm you can easily install, uninstall, and list providers, helping you to streamline your Terraform workflow.

One of the key benefits of tpm is that it does not require Terraform to be installed, making it a lightweight and efficient tool for managing your cached providers.

Terraform Provider Manager Demo

InstallationUsageUseful LinksLicense

Installation

GNU/Linux

Arch Linux from AUR (maintained by @jonathanio):

yay -S terraform-tpm-bin

macOS

Via Homebrew:

brew install madh93/tap/tpm

Windows

Via Scoop:

scoop bucket add madh93 https://github.com/madh93/scoop-bucket.git
scoop install tpm

From releases

Stable binaries for all platforms are available on the releases page. To install, download the binary for your platform from "Assets", extract the downloaded file and place tpm into your PATH:

curl -L https://github.com/Madh93/tpm/releases/latest/download/tpm_$(uname -s)_$(uname -m).tar.gz | tar -xz -O tpm > /usr/local/bin/tpm
chmod +x /usr/local/bin/tpm

Go

If you have Go installed:

go install github.com/Madh93/tpm@latest

From source

Install Go if it is not already installed. You can download it from the official website.

Clone the Terraform Provider Manager repository to build and install the binary:

git clone https://github.com/Madh93/tpm && cd tpm && make install

Usage

Terraform Provider Manager is a simple CLI to manage Terraform providers in the Terraform plugin cache directory

Usage:
  tpm [flags]
  tpm [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  install     Install a provider
  list        List all installed providers
  purge       Purge all installed providers
  uninstall   Uninstall a provider

Flags:
  -c, --config string                       config file for tpm
  -d, --debug                               enable debug mode
  -h, --help                                help for tpm
  -p, --terraform-plugin-cache-dir string   the location of the Terraform plugin cache directory (default "/home/user/.terraform.d/plugin-cache")
  -r, --terraform-registry string           the Terraform registry provider hostname (default "registry.terraform.io")
  -v, --version                             version for tpm

Use "tpm [command] --help" for more information about a command.

Install a provider

To install a provider you only need to provide the name. Optionally, you can specify a version by using <package>@<version>. By default, if no version is specified, the latest available version, also known as @latest, will be installed.

You can also specify the architecture and operating system. If not specified, the information from the system where tpm is being executed will be used.

Install a provider

In addition, it's possible to install multiple providers at once specifying a providers.yml file, making it easier to share and reuse installation requirements. For example:

providers:
  - name: hashicorp/aws@3.64.0
  - name: hashicorp/http@3.3.0
    os:
      - linux
      - darwin
    arch:
      - amd64
      - arm64
  - name: hashicorp/random
    os:
      - linux
      - darwin
    arch:
      - amd64
      - arm64

Install providers from file

The providers are installed in parallel by default. You can adjust the number of parallel jobs by using the --jobs <NUMBER> flag.

List installed providers

This will display on the screen the installed providers. Optionally, you can specify an output format. Valid output formats are:

  • text (default)
  • json
  • csv
  • table

List installed providers

Uninstall a provider

Uninstalling a provider is exactly the same as installing it. You can specify both the version, operating system, and architecture.

Uninstall a provider

Purge all providers

This will delete all installed providers from the current registry.

List installed providers

Useful Links

License

This project is licensed under the MIT license.