Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform is built on a plugin-based architecture, enabling developers to extend Terraform by writing new plugins or compiling modified versions of existing plugins.
Terraform is logically split into two main parts: Terraform Core and Terraform Plugins. Terraform Core uses remote procedure calls (RPC) to communicate with Terraform Plugins, and offers multiple ways to discover and load plugins to use. Terraform Plugins expose an implementation for a specific service, such as AWS, or provisioner, such as bash.
Terraform Core is a statically-compiled binary written in the Go programming language. The compiled binary is the command line tool (CLI)
terraform, the entrypoint for anyone using Terraform. The code is open source and hosted at github.com/hashicorp/terraform.
Terraform Plugins are written in Go and are executable binaries invoked by Terraform Core over RPC. Each plugin exposes an implementation for a specific service, such as AWS, or provisioner, such as bash. All Providers and Provisioners used in Terraform configurations are plugins. They are executed as a separate process and communicate with the main Terraform binary over an RPC interface. Terraform has several Provisioners built-in, while Providers are discovered dynamically as needed (See Discovery below). Terraform Core provides a high-level framework that abstracts away the details of plugin discovery and RPC communication so developers do not need to manage either.
Terraform Plugins are responsible for the domain specific implementation of their type.
terraform CLI tool includes several provisioner plugins for immediate use. It does not include any Providers, due to the large number of them and the various supported versions. Terraform reads configuration files and installs the needed Providers automatically from releases.hashicorp.com. At time of writing Terraform can only automatically install Providers distributed by HashiCorp, which are found on releases.hashicorp.com.
Third-party providers can be manually installed by placing their plugin executables in one of the following locations depending on the host operating system:
terraform init will search this directory for additional plugins during plugin initialization.
The naming scheme for plugins is
type is either
provisioner. Terraform uses the
NAME to understand the name and version of a particular provider binary. Third-party plugins will often be distributed with an appropriate filename already set in the distribution archive so that it can be extracted directly into the plugin directory described above.
© 2018 HashiCorpLicensed under the MPL 2.0 License.