turbot/terraform
steampipe plugin install terraform

Table: terraform_provider - Query Terraform Providers using SQL

Terraform Providers are plugins that Terraform uses to manage resources. A provider is responsible for understanding API interactions and exposing resources. Providers generally are an IaaS (e.g., Alibaba Cloud, AWS, GCP, Microsoft Azure, OpenStack), PaaS (e.g., Heroku), or SaaS services (e.g., Terraform Cloud, DNSimple, Cloudflare).

Table Usage Guide

The terraform_provider table provides insights into provider plugins in the Terraform state. As a DevOps engineer, explore provider-specific details through this table, including the provider type, version, and associated metadata. Utilize it to uncover information about providers, such as their versions, and the verification of provider configurations.

Examples

Basic info

Explore the specifics of your Terraform provider, including its name, alias, and associated arguments. This can help you better understand the configuration and structure of your Terraform environment.Explore the basic information about your Terraform providers to understand their names, aliases, and arguments, and to locate their paths. This can help streamline your configuration management and troubleshooting processes.

select
name,
alias,
arguments,
path
from
terraform_provider;
select
name,
alias,
arguments,
path
from
terraform_provider;

List providers using deprecated 'version' argument

This example helps you identify the instances where deprecated 'version' arguments are still being used in your Terraform providers. This can aid in ensuring your configuration is up-to-date and compliant with current best practices.Discover the segments that are utilizing outdated 'version' arguments in their configuration. This aids in identifying areas for potential updates and improvements.

select
name,
alias,
version,
path
from
terraform_provider
where
version is not null;
select
name,
alias,
version,
path
from
terraform_provider
where
version is not null;

List AWS providers with their regions

Explore the configuration of your AWS providers to understand the specific regions in which they operate. This can be beneficial in managing and optimizing your resource allocation across different geographical locations.Explore which AWS providers are configured across different regions. This can assist in managing resources and ensuring efficient distribution across various geographical locations.

select
name,
alias,
arguments ->> 'region' as region,
path
from
terraform_provider
where
name = 'aws';
select
name,
alias,
json_extract(arguments, '$.region') as region,
path
from
terraform_provider
where
name = 'aws';

Schema for terraform_provider

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
aliastextThe alias meta-argument to provide an extra name segment.
argumentsjsonbProvider arguments.
end_linebigintEnding line number.
nametextProvider name.
pathtext=Path to the file.
sourcetextThe block source code.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
start_linebigintStarting line number.
versiontextThe version meta-argument specifies a version constraint for a provider, and works the same way as the version argument in a required_providers block.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- terraform

You can pass the configuration to the command with the --config argument:

steampipe_export_terraform --config '<your_config>' terraform_provider