Terraform - Providers
Terraform relies on plugins called "providers" to interact with remote systems. Terraform configurations must declare which providers they require so that Terraform can install and use them.
# Configure the Azure provider
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.16.0"
}
}
required_version = ">= 1.2.0"
}
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "rg" {
name = "devtooler_dev_rg"
location = "westus3"
}
The required_providers
block must be nested inside the top-level terraform
block (which can also contain other settings).
Each argument in the required_providers
block enables one provider. The key determines the provider's local name (its unique identifier within this module), and the value is an object with the following elements:
source
- the global source address for the provider you intend to use, such as hashicorp/azurerm.version
- a version constraint specifying which subset of available provider versions the module is compatible with.
References:
Terraform Registry