What the terraform providers command tells you

Learn how the terraform providers command helps debug issues, audit dependencies, and manage provider versions in Terraform projects.

What the terraform providers command tells you
What the terraform providers command tells you

When working with Terraform, especially on complex projects, you can end up managing a lot of Azure services and knowing which Terraform providers you are using, how they are sourced and version can be key to ensuring you have Terraform code that is maintainable, easy to debug and easy to collaborate on. 

One of the simplest yet most powerful commands in your Terraform toolkit is:

terraform providers

But what does it actually do? Let’s break it down.

What is a Terraform provider?

Before diving into the command, a quick refresher: Terraform providers are plugins that let Terraform interact with APIs of various platforms like Azure, AWS, GitHub, or Kubernetes. They define the resources you can create and manage.

I have a Terraform file that deploys Azure Communication Services and at the start of the code I have these providers defined: 

terraform {
  required_version = ">= 1.10.0"
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = ">= 3.71, < 5.0.0"
    }
    random = {
      source  = "hashicorp/random"
      version = ">= 3.5.1, < 4.0.0"
    }
    azapi = {
      source  = "Azure/azapi"
      version = ">= 2.2.0, < 3.0.0"
    }
  }
}

What does the command terraform providers do?

Running: terraform providers will list:

  • All the providers used in your configuration.
  • Which modules (if any) use which providers.
  • Which versions are actually being used.
  • Where the source of the provider is (e.g. hashicorp/azurerm).

This is incredibly helpful when:

  • Debugging provider version mismatches
  • Auditing a repo for compliance
  • Understanding inherited providers in large or multi-module environments

Example output from your configuration

Using the Azure Communication Services Terraform code, if I run terraform init and then terraform providers, this is the output I get. 

Terraform providers command
Terraform providers command

Terraform returns a structured view showing which providers your configuration and state currently rely on.

In my view, I have two sections, the first is the providers required by configuration sections tells us what providers are currently declared within my Terraform code. 

  • azapi: Used to interact with Azure REST APIs
  • azurerm: The main provider for deploying Azure resources such as resource groups, etc.
  • random: I use this within my code to help randomise the Azure region I use. 
  • module.naming: This module also uses the random provider independently, which is why it's listed under the module.

Within my code, I have set a version range for each provider. This helps me safe within tested versions and avoid unexpected breaking changes when new versions are released. 

The section section is the providers required by state section which shows which providers are currently in use in the actual Terraform state file—that is, what has already been deployed.

Ideally, what’s in your configuration and what’s in your state should match. In your case, they do, which means your project is in a healthy, expected state. If they didn’t match, it might mean:

  • You removed a provider from the config, but the resources it created are still managed in state.
  • You updated a module or version but haven’t run terraform apply yet.

Why This Matters in Real-Life Projects

At first glance, the output from terraform providers might seem like just a list of technical details — something you could ignore once your infrastructure is up and running. But in real-world projects, especially as they grow in complexity or involve multiple teams, understanding this output becomes essential.

One of the key benefits of this command is clarity. It gives you a precise view of which Terraform providers your configuration is depending on, and more importantly, what’s actually in use within your state file. This becomes particularly valuable when you're troubleshooting. 

By running terraform providers, you get a clear picture of all dependencies,  even the ones nested inside modules. This visibility helps you avoid version conflicts or issues where one part of your infrastructure behaves differently because it relies on a slightly older or newer version of a provider.

In Summary

The terraform providers command isn’t just for show — it’s a core part of understanding and controlling your project’s dependencies. Whether you're building advanced configurations or managing simpler infrastructure, this command gives you visibility into your project's backbone.