turbot/terraform
steampipe plugin install terraform

Table: terraform_local - Query Terraform Local Values using SQL

Terraform Local Values are a convenient naming mechanism that allows users to assign a name to an expression so it can be used multiple times within a module without repeating it. Local Values can be helpful to avoid repeating the same values or expressions multiple times in a Terraform configuration. If overused, they can also make configuration hard to read and understand if the reader has to continually lookup the values.

Table Usage Guide

The terraform_local table provides insights into local values within Terraform. As a DevOps engineer, explore local value-specific details through this table, including the final local value name and its corresponding expression. Utilize it to uncover information about local values, such as those that are used multiple times, to avoid repetition and enhance the readability of the Terraform configuration.

Examples

Basic info

Analyze the settings to understand the basic information stored in your Terraform local configurations. This can assist in identifying potential configuration issues or inconsistencies.This query allows you to gain insights into the local values defined in your Terraform code. It can be useful to understand your configuration and to identify specific settings or paths that may need to be modified or reviewed.

select
name,
value,
path
from
terraform_local;
select
name,
value,
path
from
terraform_local;

List 'Owner' locals (case insensitive)

Analyze the settings to understand who the owners are across various paths in a case-insensitive manner. This can be beneficial in managing access rights and maintaining security protocols.Identify instances where the 'owner' locals are used in the Terraform configuration to understand the ownership details in the system. This can be particularly useful in managing and organizing resources effectively.

select
name,
value,
path
from
terraform_local
where
name ilike 'owner';
select
name,
value,
path
from
terraform_local
where
name like 'owner';

Schema for terraform_local

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
end_linebigintEnding line number.
nametextLocal 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.
valuejsonbLocal value.

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_local