Typorithm · easy

Provider Block

terraform-providerterraformproviderrequired_providersversion
Saved on this device
Full lesson · 8 learning steps Open any exercise for focused practice
1

Step 1 of 8 · intro card

Learn Provider Block

0%

HCL Basics

The terraform { required_providers } block declares providers and pins their versions; a separate provider block configures one, like setting the AWS region.

Every Terraform configuration that touches a real platform depends on a provider — a plugin that knows how to talk to AWS, GCP, Kubernetes, and so on.

The terraform { required_providers { ... } } block names each provider, its registry source (namespace/type), and a version constraint so collaborators resolve the same plugin.

A separate provider "aws" { ... } block then configures that provider, supplying settings like region or credentials.

01

required_providers names the source and version.

02

source is namespace/type, e.g. hashicorp/aws.

03

provider "aws" { } configures the named provider.

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
}

provider "aws" {
  region = "us-east-1"
}

Read the implementation

Connect each part of the code to the concept before you type.

1. Terraform settings

The terraform { required_providers { ... } } block declares which providers a configuration depends on and where to fetch them.

terraform {
  required_providers {

2. Provider source

source is the registry address (namespace/type) Terraform uses to download the provider plugin.

source  = "hashicorp/aws"

3. Version pin

version pins the acceptable provider range; ~> 5.0 allows 5.x but not 6.0, keeping upgrades predictable.

version = "~> 5.0"

4. Provider config

The provider block configures the named provider — here AWS, told which region to operate in.

provider "aws" {
  region = "us-east-1"

A complete learning loop

01

Understand

Read the concept map and follow the code breakdown.

02

Reconstruct

Type the implementation, repair mistakes and work through every recall exercise.

03

Verify

Use the final check without hints; revisit weak concepts in short practice sessions.

Provider Block: Lesson & Practice · Typorithm | ApplyDjinn