Command: providers
Theterraform providers command shows information about the provider requirements of the configuration in the current working directory.
Usage
Description
This command prints out a tree of modules in the referenced configuration, annotated with their provider requirements. It provides an overview of all provider requirements across all referenced modules, as an aid to understanding:- Why particular provider plugins are needed
- Which particular versions are selected
- How providers are used across modules and tests
- Providers required by configuration: A hierarchical tree showing all providers needed by the root module, child modules, and test files
- Providers required by state: A list of providers that are used in the current state (if any)
Options
-test-directory=path- Set the Terraform test directory. Defaults to"tests".
Output Format
The output is organized as a tree structure:Tree Structure Elements
- Root level: Providers required directly by the root module configuration
- module.<name>: Providers required by child modules
- test.<name>: Providers required by test files (
.tftest.hclfiles) - run.<name>: Providers required by specific test runs within test files
Implementation Details
The command:- Loads the configuration from the current directory
- Validates that the directory contains Terraform configuration files
- Loads the backend and retrieves the current state
- Analyzes provider requirements from both configuration and state
- Builds a tree representation of provider dependencies
Examples
Basic Usage
Show all providers required by the current configuration:With Custom Test Directory
Specify a different directory for test files:Change Working Directory
Analyze providers for a configuration in a different directory:When to Use
Useterraform providers to:
- Audit which providers are used in your configuration
- Understand the provider dependency tree across modules
- Verify provider version constraints
- Identify providers that are in state but no longer in configuration
- Debug provider-related issues
- Document provider requirements for a project
Related Commands
terraform providers lock- Write out dependency locks for providersterraform providers mirror- Save local copies of provider pluginsterraform providers schema- Show schemas for providersterraform init- Initialize providers and download pluginsterraform version- Show Terraform and provider versions