Adding Provider Source to HashiCorp Terraform
Recently, we announced some exciting plans for the HashiCorp Terraform Registry: we will be adding Terraform providers in the Registry. We've started with HashiCorp maintained providers, which will continue to be installed automatically on terraform init
, and are working to include all Terraform providers. Once that happens, Terraform will be able to automatically download and install all providers published in the Registry, including community providers.
While the installation process for HashiCorp maintained providers isn't changing, the configuration language is getting an update to support the eventual inclusion of partner and community providers in the Terraform Registry. Note, however, that we are not planning to make any breaking changes before the release of Terraform 0.13. As we work on these updates to the configuration language, we'll keep you posted on what will change or look different. For now, we're excited to show you some new—and optional—enhancements to the configuration language in upcoming releases.
» Provider Source
When using the required_providers
setting to specify a version constraint, Terraform currently assumes the source is registry.terraform.io
(or releases.hashicorp.com
for older versions). Both registry.terraform.io
and releases.hashicorp.com
are populated by the providers grouped within the the terraform-providers organization on GitHub.
In order to simplify using providers from other sources, we will be extending required_providers
to allow a registry source for any provider. Authors can host and publish providers to the Registry from their own GitHub repositories.
You won't need to declare the source if you are using one of HashiCorp's providers. Terraform will continue to automatically download them from the appropriate source. Instead, this feature enables you to declare the provider source and Terraform will automatically download it during terraform init
. Our goal is to simplify provider use, offering streamlined access to partner and community providers while also providing clear links to the ownership of all providers.
Let’s examine these changes in a Terraform configuration using both the existing and new syntax:
terraform {
required_providers {
# This is the current syntax, which is still supported
random = ">= 2.7.0"
# This is the new syntax. "source" and "version" are both
# optional, though in the future "source" will be required for
# any provider that isn't maintained by HashiCorp.
random = {
source = "registry.terraform.io/hashicorp/random"
version = "2.1.0"
}
}
}
Starting with Terraform 0.12.20, Terraform can parse a required_providers
block with the new syntax, though any source attribute will be ignored silently for now.
The goal of these changes is to simplify the installation and use of providers for all workflows. While the current focus is on how Terraform interacts with the public registry, we are also working to improve the experience for practitioners using providers not listed in our registry, private providers, and those working in air-gapped environments.
We would love to hear your feedback on these changes. Please use our community forums for questions, and open an issue in GitHub if you come across any problems with the new syntax or have a feature request.
Sign up for the latest HashiCorp news
More blog posts like this one
Fix the developers vs. security conflict by shifting further left
Resolve the friction between dev and security teams with platform-led workflows that make cloud security seamless and scalable.
HashiCorp at AWS re:Invent: Your blueprint to cloud success
If you’re attending AWS re:Invent in Las Vegas, Dec. 2 - Dec. 6th, visit us for breakout sessions, expert talks, and product demos to learn how to take a unified approach to Infrastructure and Security Lifecycle Management.
Speed up app delivery with automated cancellation of plan-only Terraform runs
Automatic cancellation of plan-only runs allows customers to easily cancel any unfinished runs for outdated commits to speed up application delivery.