Terraform + Steampipe
A Terraform configuration file is used to declare resources, variables, modules, and more.
Steampipe is an open source CLI to instantly query data using SQL.
Query all resources in your Terraform files:
select name, type, jsonb_pretty(arguments) as argsfrom terraform_resource;
> select name, type, jsonb_pretty(arguments) as args from terraform_resource;+------------+----------------+--------------------------------------------+| name | type | args |+------------+----------------+--------------------------------------------+| app_server | aws_instance | { || | | "ami": "ami-830c94e3", || | | "tags": { || | | "Name": "ExampleAppServerInstance" || | | }, || | | "instance_type": "t2.micro" || | | } || app_volume | aws_ebs_volume | { || | | "size": 40, || | | "tags": { || | | "Name": "HelloWorld" || | | }, || | | "availability_zone": "us-west-2a" || | | } || app_bucket | aws_s3_bucket | { || | | "acl": "private", || | | "tags": { || | | "Name": "Test bucket", || | | "Environment": "Dev" || | | }, || | | "bucket": "my-app-bucket" || | | } |+------------+----------------+--------------------------------------------+
Documentation
Get started
Install
Download and install the latest Terraform plugin:
steampipe plugin install terraform
Credentials
No credentials are required.
Configuration
Installing the latest terraform plugin will create a config file (~/.steampipe/config/terraform.spc
) with a single connection named terraform
:
connection "terraform" { plugin = "terraform"
# Paths is a list of locations to search for Terraform configuration files # All paths are resolved relative to the current working directory (CWD) # Wildcard based searches are supported, including recursive searches
# For example: # - "*.tf" matches all Terraform configuration files in the CWD # - "**/*.tf" matches all Terraform configuration files in the CWD and all sub-directories # - "../*.tf" matches all Terraform configuration files in the CWD's parent directory # - "steampipe*.tf" matches all Terraform configuration files starting with "steampipe" in the CWD # - "/path/to/dir/*.tf" matches all Terraform configuration files in a specific directory # - "/path/to/dir/main.tf" matches a specific file
# If paths includes "*", all files (including non-Terraform configuration files) in # the CWD will be matched, which may cause errors if incompatible file types exist
# Defaults to CWD paths = [ "*.tf" ]}
paths
- A list of directory paths to search for Terraform files. Paths are resolved relative to the current working directory. Paths may include wildcards and also support**
for recursive matching. Defaults to the current working directory.
Get involved
- Open source: https://github.com/turbot/steampipe-plugin-terraform
- Community: Slack Channel