Course contentsShow
← Software Engineering
Lesson 1482 of 1,93343. Infrastructure as CodeFree lesson

Terraform Resources and Providers

Understanding Terraform providers for different platforms and resources as the building blocks of infrastructure.

Terraform Resources and Providers

What you'll learn: How Terraform uses providers to communicate with different platforms and resources to define your infrastructure's building blocks.

The Building Blocks of Terraform

In Terraform, providers are plugins that enable communication with specific platforms or services (AWS, Azure, GCP, Kubernetes, Docker, etc.). Think of a provider as a translator that speaks both Terraform's language and the API language of a particular platform.

Resources are the actual infrastructure components you want to create or manage—virtual machines, databases, networks, storage buckets, or anything else your platform offers. Each resource is defined by a specific provider.

How They Work Together

You declare a provider at the top of your Terraform configuration to tell Terraform which platform you're targeting:

provider "aws" {
  region = "us-west-2"
}

Then you define resources using that provider's available resource types:

resource "aws_instance" "web_server" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "t2.micro"
}

The resource type (aws_instance) tells Terraform both which provider to use (aws) and what kind of infrastructure component to create (instance). Terraform uses the provider to translate this declarative configuration into actual API calls to AWS.

The Ecosystem

Different providers expose different resource types based on what their platforms offer. The aws provider has hundreds of resource types (EC2 instances, S3 buckets, RDS databases), while a DNS provider might only have a few (zones, records). This modular design lets Terraform manage infrastructure across any platform with an available provider.

Key Takeaway: Terraform providers are platform-specific plugins that enable infrastructure management, while resources are the individual infrastructure components you declare and provision through those providers—together they form a flexible, declarative infrastructure definition system.