Terraform Tutorial — What is a Provider?
A provider is a plugin that teaches Terraform how to talk to a specific API. Think of it as a translator — your HCL configuration says “create an S3 bucket” and the AWS provider translates that into the correct AWS API calls.
How Providers Work
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ .tf files │────▶│ Terraform │────▶│ Cloud API │
│ (HCL) │ │ CLI + │ │ (AWS, GCP, │
│ │ │ Provider │ │ Azure, etc) │
└──────────────┘ └──────────────┘ └──────────────┘
- You write
.tffiles describing resources - Terraform reads your config and loads the appropriate provider
- The provider makes API calls to create, update, or delete resources
- Terraform records the result in state
Without a provider, Terraform doesn’t know how to interact with any platform. The provider is the bridge.
Provider Types
Providers exist for virtually every service you can imagine:
| Category | Examples |
|---|---|
| Major Clouds | AWS, Azure, GCP, Oracle Cloud, Alibaba Cloud |
| Infrastructure | Kubernetes, Docker, Helm, Consul, Vault |
| Monitoring | Datadog, PagerDuty, Grafana, New Relic |
| DNS/CDN | Cloudflare, Route53, Akamai |
| Version Control | GitHub, GitLab, Bitbucket |
| Databases | MongoDB Atlas, Snowflake, InfluxDB |
| SaaS | Auth0, Okta, Twilio, SendGrid |
The Terraform Registry lists all available providers — over 3,000 and growing.
Provider vs Resource
- A provider is the plugin (e.g., the AWS provider)
- A resource is a specific thing the provider manages (e.g.,
aws_s3_bucket)
The resource type name always starts with the provider prefix:
| Resource Type | Provider |
|---|---|
aws_s3_bucket |
AWS |
aws_instance |
AWS |
azurerm_resource_group |
Azure |
google_compute_instance |
GCP |
kubernetes_namespace |
Kubernetes |
Provider vs Terraform Version
These are separate things with separate version constraints:
| Component | What It Is | Version Example |
|---|---|---|
| Terraform CLI | The binary you installed | 1.7.5 |
| AWS Provider | Plugin for AWS API | 5.31.0 |
| Azure Provider | Plugin for Azure API | 3.85.0 |
You can use Terraform 1.7 with AWS Provider 5.x and Azure Provider 3.x — they version independently.
terraform init Downloads Providers
When you run terraform init, Terraform:
- Reads your
required_providersblock - Downloads the specified provider versions from the Terraform Registry
- Caches them in
.terraform/providers/ - Creates or updates
.terraform.lock.hcl
$ terraform init
Initializing the backend...
Initializing provider plugins...
- Finding hashicorp/aws versions matching "~> 5.0"...
- Installing hashicorp/aws v5.31.0...
- Installed hashicorp/aws v5.31.0 (signed by HashiCorp)
Terraform has been successfully initialized!
You only need to re-run terraform init when you add a new provider or change version constraints.
What’s Next?
Now that you understand what providers are, let’s see how to declare them in your configuration with the required_providers block.