required_providers
The block inside the terraform block that lists each provider a configuration needs, where to download it from and which versions are acceptable.
In more detail
Each entry has a local name on the left, and a source address and version constraint inside. Declaring a provider here only says which plugin is needed; configuring it, with a region or credentials, is done in a separate provider block. terraform init reads this block to decide what to download.
Example
required_providers {
local = {
source = "hashicorp/local"
version = "~> 2.5"
}
}Related terms
- provider — A plugin that teaches Terraform how to talk to one API, such as AWS or your local disk, and which resource types it offers.
- source address — The global name of a provider or module, such as hashicorp/local, made of a namespace and a name (and a registry host, usually left out).
- local name — The short name you give a provider inside one configuration, used as the prefix of resource types and in provider blocks.
- version constraint — A string such as "~> 3.6" or ">= 1.6.0" that says which versions of Terraform, a provider or a module are acceptable.
- provider block — A top-level block that configures a provider, for example which region or endpoint it talks to and which credentials it uses.
Taught in
- Installing Terraform And Meeting The CLI — Infrastructure as Code with Terraform
- Providers And The required_providers Block — Infrastructure as Code with Terraform
- Providers: How Terraform Reaches Every API — HashiCorp Terraform Associate (004) Exam Prep