Terraform Provider — Short Notes
- A Terraform provider is a plugin that lets Terraform interact with a platform (AWS, Azure, GCP, Docker, Kubernetes, etc.).
- Providers translate Terraform code (HCL) into real API calls on the target service.
- Types of providers: official, partner, and community.
- Provider details, supported resources, and examples are available on the Terraform Registry.
Terraform & Provider Blocks
terraform block
- Sets Terraform CLI version (
required_version).
- Defines provider versions under
required_providers.
provider block
- Configures settings for the provider (e.g., AWS region).
Example:
provider "aws" {
region = "us-east-1"
}
Version Constraints
Used to control which versions are allowed.
Operators: =, !=, <, >, <=, >=, and ~> (pessimistic constraint).
Basic Resource Example