Desired infrastructure and providers

Terraform uses configuration files to describe infrastructure. A provider lets Terraform interact with a platform or service. Terraform compares configuration with its recorded

Terraform uses configuration files to describe infrastructure. A provider lets Terraform interact with a platform or service. Terraform compares configuration with its recorded state and the provider’s view to propose changes.

Illustrative provider configuration

hcl · static example

terraform {
  required_providers {
    local = {
      source  = "hashicorp/local"
      version = "~> 2.5"
    }
  }
}

provider "local" {}

This provider example works with local files for learning. Cloud providers may create billable resources and need credentials and permissions.

Initialize the working directory

Initialization downloads required provider plugins and prepares the directory for Terraform operations.

terraform init

Static example · not executed

Knowledge check

What is a provider’s role?

Pick an answer to check.