# Terraform Providers

In 
Published 2022-12-03

This tutorial explains what a Terraform provider is.

Terraform is an open-source infrastructure as code (IaC) software tool that enables you to safely and predictably create, change, and improve infrastructure. This includes low-level components like compute instances, storage, and networking, as well as high-level components like DNS entries and SaaS features.

Terraform will not create directly the resource we need. Terraform communicates with a cloud and finally, the cloud is creating that resource.

Terraform Providers allows you that communication. Providers are a logical abstraction of an upstream API. They are responsible for understanding API interactions and exposing resources.

Here we have the Terraform providers.

Each Terraform script starts by defining the provider it uses.

For Azure, we can have :

# 1. Specify the version of the AzureRM Provider to use
terraform {
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = "=3.0.1"
    }
  }
}

# 2. Configure the AzureRM Provider
provider "azurerm" {
  features {}
}

For AWS, we can have :

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = "4.27.0"
    }
  }
}

provider "aws" {
  # Configuration options
}

For GCP, we can have :

terraform {
  required_providers {
    google = {
      source = "hashicorp/google"
      version = "3.5.0"
    }
  }
}

provider "google" {
  # Configuration options
}

One time the Terraform Provider is defined in our script, we can define the resources we need to create.