1. Terraform settings
The terraform { required_providers { ... } } block declares which providers a configuration depends on and where to fetch them.
terraform {
required_providers {Typorithm · easy
Step 1 of 8 · intro card
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.
required_providers names the source and version.
source is namespace/type, e.g. hashicorp/aws.
provider "aws" { } configures the named provider.
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
provider "aws" {
region = "us-east-1"
}Connect each part of the code to the concept before you type.
The terraform { required_providers { ... } } block declares which providers a configuration depends on and where to fetch them.
terraform {
required_providers {source is the registry address (namespace/type) Terraform uses to download the provider plugin.
source = "hashicorp/aws"version pins the acceptable provider range; ~> 5.0 allows 5.x but not 6.0, keeping upgrades predictable.
version = "~> 5.0"The provider block configures the named provider — here AWS, told which region to operate in.
provider "aws" {
region = "us-east-1"Read the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.