This blog has been updated on 19 August 2024 to update the list and information.
Terraform would be pretty useless without its providers. Providers are essentially plugins that allow Terraform to interact with remote systems. They are either maintained by Hashicorp, third-party technology partners or Terraform community members.
We took a look at the most popular Terraform providers by the number of installs from the Terraform registry. There are 7 utility providers (Null, Random, Archive, Local, External, TLS, HTTP, Template), 4 public cloud providers (AWS, Azure, Google Cloud Platform, Google Beta), 3 SaaS platforms (Datadog, Cloudflare, Github) 1 HashiCorp Platform providers (Vault), 1 container orchestration provider (Kubernetes), 1 cloud automation provider (Helm) and 1 security & authentication provider (Azure Active Directory).
All of this information was pulled from library.tf, where you will not only see Terraform providers, but also OpenTofu. Library.tf also provides insights into providers and modules giving you the information you need to decide on which provider is best for you.
Does the AWS provider need an introduction? AWS is the biggest cloud provider in the world in terms of market share, so it comes as no surprise that its provider is also the most popular one of the Terraform registry. Use the AWS provider to manage the lifecycle of AWS resources, such as EC2, Lambda, EKS, ECS, VPC, S3, RDS, DynamoDB, and more.
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
}
}
}
# Configure the AWS Provider
provider "aws" {
region = "us-east-1"
}
# Create a VPC
resource "aws_vpc" "example" {
cidr_block = "10.0.0.0/16"
}
Interesting stat: Up from 236M installs in 2021.
The random provider adds support for randomness within Terraform configurations. It’s a useful provider to generate UUIDs or passwords securely and reliably. The random values generated are held steady until the inputs are changed to preserve Terraform’s fixed-configuration model.
resource "random_id" "server" {
keepers = {
# Generate a new id each time we switch to a new AMI id
ami_id = "${var.ami_id}"
}
byte_length = 8
}
resource "aws_instance" "server" {
tags = {
Name = "web-server ${random_id.server.hex}"
}
# Read the AMI id "through" the random_id resource to ensure that
# both will change together.
ami = "${random_id.server.keepers.ami_id}"
# ... (other aws_instance arguments) ...
}
Interesting stat: Previously ranked #3 in 2021 with 55.3M installs.
The second most popular provider of the Terraform registry is a utility provided by Hashicorp. According to its documentation, the null provider “provides constructs that intentionally do nothing – useful in various situations to help orchestrate tricky behavior or work around limitations.”. An example of that would be to execute a script once the provisioning is completed.
resource "aws_instance" "cluster" {
count = 3
# ...
}
resource "null_resource" "cluster" {
# Changes to any instance of the cluster requires re-provisioning
triggers = {
cluster_instance_ids = "${join(",", aws_instance.cluster.*.id)}"
}
# Bootstrap script can run on any instance of the cluster
# So we just choose the first in this case
connection {
host = "${element(aws_instance.cluster.*.public_ip, 0)}"
}
provisioner "remote-exec" {
# Bootstrap script called with private_ip of each node in the clutser
inline = [
"bootstrap-cluster.sh ${join(" ", aws_instance.cluster.*.private_ip)}",
]
}
}
Interesting stat: Previously ranked #2 in 2021 with 78.3M installs.
The Google provider is used to configure Google Cloud Platform infrastructure (Compute Engine, Cloud Storage, Cloud SDK, Cloud SQL, GKE, BigQuery, Cloud Functions, …).
provider "google" {
project = "{{YOUR GCP PROJECT}}"
region = "us-central1"
zone = "us-central1-c"
}
resource "google_compute_instance" "vm_instance" {
name = "terraform-instance"
machine_type = "f1-micro"
boot_disk {
initialize_params {
image = "debian-cloud/debian-9"
}
}
network_interface {
# A default network is created for all GCP projects
network = "default"
access_config {
}
}
}
Interesting stat: Previously ranked #5 in 2021 with 33.5M installs.
Even though it has been archived, it is still being used heavily. The suggestion is to use the “templatefile” or “Cloudinit” provider instead.
# Template for initial configuration bash script
data "template_file" "init" {
template = "${file("init.tpl")}"
vars = {
consul_address = "${aws_instance.consul.private_ip}"
}
}
# Create a web server
resource "aws_instance" "web" {
# ...
user_data = "${data.template_file.init.rendered}"
}
Interesting stat: Previously unranked.
The Azurerm provider enables the lifecycle management of Microsoft Azure using the Azure Resource Manager APIs.
# Configure the Azure Provider
provider "azurerm" {
# whilst the `version` attribute is optional, we recommend pinning to a given version of the Provider
version = "=2.40.0"
features {}
}
# Create a resource group
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
# Create a virtual network within the resource group
resource "azurerm_virtual_network" "example" {
name = "example-network"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
address_space = ["10.0.0.0/16"]
}
Interesting stat: Dropped from #3 with 36.6M installs in 2021.
The Kubernetes providers enables the management of Kubernetes resources, including Pods, Services, Policies, Quotas and more using Terraform.
provider "kubernetes" {
config_path = "~/.kube/config"
config_context = "my-context"
}
resource "kubernetes_namespace" "example" {
metadata {
name = "my-first-namespace"
}
}
Interesting stat: Jumped from #8 with 22.5M installs in 2021.
The Google Beta provider is distinct from the Google provider in that it supports Google Cloud Platform products and features that are in beta, while the Google provider does not.
resource "google_container_node_pool" "primary_preemptible_nodes" {
name = "my-node-pool"
location = "us-central1"
cluster = google_container_cluster.primary.name
node_count = 1
node_config {
preemptible = true
machine_type = "e2-medium"
# Google recommends custom service accounts that have cloud-platform scope and permissions granted via IAM Roles.
service_account = google_service_account.default.email
oauth_scopes = [
"https://www.googleapis.com/auth/cloud-platform"
]
}
}
Interesting stat: Jumped from #10 with 14.6M installs in 2021.
The Local provider is used to manage local resources, such as files.
# local_file reads a file from the local filesystem.
data "local_file" "foo" {
filename = "${path.module}/foo.bar"
}
Interesting stat: Dropped from #7 with 23.6M installs in 2021.
The External provider is a special provider that exists to provide an interface between Terraform and external programs – useful for integrating Terraform with a system for which a first-class provider does not exist.
data "external" "example" {
program = ["python", "${path.module}/example-data-source.py"]
query = {
# arbitrary map from strings to strings, passed
# to the external program as the data query.
id = "abc123"
}
}
Interesting stat: Dropped from #9 with 21.9M installs in 2021.
Helps with time-based resources.
resource "time_static" "ami_update" {
triggers = {
# Save the time each switch of an AMI id
ami_id = data.aws_ami.example.id
}
}
resource "aws_instance" "server" {
# Read the AMI id "through" the time_static resource to ensure that
# both will change together.
ami = time_static.ami_update.triggers.ami_id
tags = {
AmiUpdateTime = time_static.ami_update.rfc3339
}
# ... (other aws_instance arguments) ...
}
Interesting stat: Not ranked in 2021.
The Vault provider allows Terraform to read from, write to, and configure Hashicorp Vault.
provider "vault" {
# It is strongly recommended to configure this provider through the
# environment variables described above, so that each user can have
# separate credentials set in the environment.
#
# This will default to using $VAULT_ADDR
# But can be set explicitly
# address = "https://vault.example.net:8200"
}
resource "vault_generic_secret" "example" {
path = "secret/foo"
data_json = <<EOT
{
"foo": "bar",
"pizza": "cheese"
}
EOT
}
Interesting stat: Dropped from #11 with 12.1M installs in 2021.
Provides utilities for working with Transport Layer Security keys and certificates. It provides resources that allow private keys, certificates and certificate requests to be created as part of a Terraform deployment.
## This example creates a self-signed certificate for a development
## environment.
## THIS IS NOT RECOMMENDED FOR PRODUCTION SERVICES.
## See the detailed documentation of each resource for further
## security considerations and other practical tradeoffs.
resource "tls_private_key" "example" {
algorithm = "ECDSA"
}
resource "tls_self_signed_cert" "example" {
key_algorithm = tls_private_key.example.algorithm
private_key_pem = tls_private_key.example.private_key_pem
# Certificate expires after 12 hours.
validity_period_hours = 12
# Generate a new certificate if Terraform is run within three
# hours of the certificate's expiration time.
early_renewal_hours = 3
# Reasonable set of uses for a server SSL certificate.
allowed_uses = [
"key_encipherment",
"digital_signature",
"server_auth",
]
dns_names = ["example.com", "example.net"]
subject {
common_name = "example.com"
organization = "ACME Examples, Inc"
}
}
# For example, this can be used to populate an AWS IAM server certificate.
resource "aws_iam_server_certificate" "example" {
name = "example_self_signed_cert"
certificate_body = tls_self_signed_cert.example.cert_pem
private_key = tls_private_key.example.private_key_pem
}
Interesting stat: Stayed at #13 with 9.5M installs in 2021.
The Archive provider generates an archive from content, a file, or directory of files.
# Archive a single file.
data "archive_file" "init" {
type = "zip"
source_file = "${path.module}/init.tpl"
output_path = "${path.module}/files/init.zip"
}
# Archive multiple files and exclude file.
data "archive_file" "dotfiles" {
type = "zip"
output_path = "${path.module}/files/dotfiles.zip"
excludes = ["${path.module}/unwanted.zip"]
source {
content = data.template_file.vimrc.rendered
filename = ".vimrc"
}
source {
content = data.template_file.ssh_config.rendered
filename = ".ssh/config"
}
}
Interesting stat: Dropped from #6 with 25.2M installs in 2021.
Manage installed Charts in your Kubernetes cluster, in the same way Helm does, through Terraform.
provider "helm" {
kubernetes {
config_path = "~/.kube/config"
}
}
resource "helm_release" "nginx_ingress" {
name = "nginx-ingress-controller"
repository = "https://charts.bitnami.com/bitnami"
chart = "nginx-ingress-controller"
set {
name = "service.type"
value = "ClusterIP"
}
}
Interesting stat: Dropped from #12 with 9.7M installs in 2021.
Configure infrastructure in Azure Active Directory using the Azure Resource Manager APIs.
# Configure the Microsoft Azure Active Directory Provider
provider "azuread" {
version = "=0.7.0"
}
# Create an application
resource "azuread_application" "example" {
name = "ExampleApp"
}
# Create a service principal
resource "azuread_service_principal" "example" {
application_id = azuread_application.example.application_id
}
Interesting stat: Dropped from #14 with 7.5M installs in 2021.
Configure and automate Datadog resources to automate monitoring and logging through the API
terraform {
required_providers {
datadog = {
source = "DataDog/datadog"
}
}
}
# Configure the Datadog provider
provider "datadog" {
api_key = var.datadog_api_key
app_key = var.datadog_app_key
}
resource "datadog_monitor" "bar" {
name = "Composite Monitor"
type = "composite"
message = "This is a message"
query = "${datadog_monitor.foo.id} || ${datadog_synthetics_test.foo.monitor_id}"
}
Interesting stat: Not ranked in 2021.
The HTTP provider is a utility provider for interacting with generic HTTP servers as part of a Terraform configuration.
data "http" "example" {
url = "https://checkpoint-api.hashicorp.com/v1/check/terraform"
# Optional request headers
request_headers = {
Accept = "application/json"
}
}
Interesting stat: Dropped from #15 with 3.8M installs in 2021.
Use the GitHub provider to interact with the Github API to create repositories, manage users, and more.
terraform {
required_providers {
github = {
source = "integrations/github"
version = "~> 6.0"
}
}
}
# Configure the GitHub Provider
provider "github" {}
# Add a user to the organization
resource "github_membership" "membership_for_user_x" {
# ...
}
Interesting stat: Not ranked in 2021.
Use this provider to interact with Cloudflare to create records, page rules, and much more.
terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 4.0"
}
}
}
provider "cloudflare" {
api_token = var.cloudflare_api_token
}
# Create a record
resource "cloudflare_record" "www" {
# ...
}
# Create a page rule
resource "cloudflare_page_rule" "www" {
# ...
}
Interesting stat: Not ranked in 2021.
The first version of this blog post was posted in 2021 and since then, the following providers have dropped off the top 20 list:
The Scalr Terraform provider can be used to manage the components within Scalr. This will allow you to automate the creation of workspaces, variables, VCS providers and much more.