Use SQL to instantly query resources, data sources and more from Terraform code. Open source CLI. No DB required.

image

Terraform Plugin for Steampipe

Use SQL to query data from Terraform configuration files.

Quick start

Install the plugin with Steampipe:

steampipe plugin install terraform

Configure your config file.

Run steampipe:

steampipe query

Query all resources in your Terraform files:

select
  name,
  type,
  jsonb_pretty(arguments) as args
from
  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"              |
|            |                | }                                          |
+------------+----------------+--------------------------------------------+

Developing

Prerequisites:

Clone:

git clone https://github.com/turbot/steampipe-plugin-terraform.git
cd steampipe-plugin-terraform

Build, which automatically installs the new version to your ~/.steampipe/plugins directory:

make

Configure the plugin:

cp config/* ~/.steampipe/config
vi ~/.steampipe/config/terraform.spc

Try it!

steampipe query
> .inspect terraform

Further reading:

Contributing

Please see the contribution guidelines and our code of conduct. All contributions are subject to the Apache 2.0 open source license.

help wanted issues:

Owner
Turbot
Get cloud work done with Turbot — Creators of https://turbot.com/v5 and https://steampipe.io
Turbot
Comments
  • Re-add secret detection examples to terraform_local and terraform_output table docs once quals bug is fixed

    Re-add secret detection examples to terraform_local and terraform_output table docs once quals bug is fixed

    Examples for secret scanning would be great, but there's currently a bug that prevents it from working (https://github.com/turbot/steampipe/issues/1201). Once this bug is fixed, or a workaround is made available, these examples can be re-added.

  • Add File Watcher support for `paths` argument in terraform config

    Add File Watcher support for `paths` argument in terraform config

    Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

    Describe the solution you'd like A clear and concise description of what you want to happen.

    Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

    Additional context Add any other context or screenshots about the feature request here.

  • Update plugin to discover all the TF files present in CWD by default. Closes #6

    Update plugin to discover all the TF files present in CWD by default. Closes #6

    Updates:

    • Update paths default to ["*.tf"], so TF files in the current directory are loaded (non-recursively)
    • paths arg is no longer commented out by default
    • Add support for ~ expansion in paths
    • Add support for ** to support matching recursively
    • Remove file extension matching when using wildcards, e.g., if paths = [ "*" ], files not ending in .tf will be loaded as well, which would cause a parsing error
    • The plugin will still fail to initialize if paths is not defined (as a warning to users)
  • Querying the `terraform_local` table sometimes results in a conversion error

    Querying the `terraform_local` table sometimes results in a conversion error

    Describe the bug When querying any column from terraform_local, sometimes a conversion error is returned:

    Error: Failed to convert value map[_kics__default:{16 []} _kics_array:{21 [map[_kics__default:{21 []}] map[_kics__default:{21 []}] map[_kics__default:{0 [map[_kics__default:{21 []}] map[_kics__default:{0 [map[_kics__default:{21 []}]]}]]}]]} _kics_faz:{17 []} _kics_faz1:{18 []} _kics_myInt:{19 []} _kics_myNum:{20 []} _kics_simple_array:{22 [map[_kics__default:{22 []}]]}] due to unknown type: map[string]model.LineObject (SQLSTATE HV000)
    

    Steampipe version (steampipe -v) v0.11.2

    Plugin version (steampipe plugin list) v0.0.2

    To reproduce Create a TF file with at least one locals block and run select * from terraform_local (may need to run multiple times, as this only occurs sometimes).

    Expected behavior Queries should not return an error

    Additional context Add any other context about the problem here.

  • Can we discover TF files in the current working directory by default?

    Can we discover TF files in the current working directory by default?

    Terraform users are used to the idea of running TF commands in the current working directory for their files. It's inconvenient and unintuitive that we require the paths to be configured first. Can we discover files in the current working directory by default?

    The obvious snag is operation when in service mode - we'd need to think about that a bit more carefully as part of this.

  • [WIP] Add support to read files from  directories and various sources using a URL and add file watcher support for `paths` arguments

    [WIP] Add support to read files from directories and various sources using a URL and add file watcher support for `paths` arguments

    Integration test logs

    Logs
    Add passing integration test logs here
    

    Example query results

    Results
    Add example SQL query results here (please include the input queries as well)
    
  • Add CHANGELOG for v0.2.0

    Add CHANGELOG for v0.2.0

    Integration test logs

    Logs
    Add passing integration test logs here
    

    Example query results

    Results
    Add example SQL query results here (please include the input queries as well)
    
  • Recompile plugin with steampipe-plugin-sdk v3.3.2

    Recompile plugin with steampipe-plugin-sdk v3.3.2

    select
      name,
      type,
      jsonb_pretty(arguments) as args
    from
      terraform_resource;
    +------------------------------------------------------+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------
    | name                                                 | type                                          | args                                                                                                                               
    +------------------------------------------------------+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------
    | example                                              | aws_api_gateway_method_settings               | {                                                                                                                                  
    |                                                      |                                               |     "settings": {                                                                                                                  
    |                                                      |                                               |         "logging_level": "INFO",                                                                                                   
    |                                                      |                                               |         "caching_enabled": true,                                                                                                   
    |                                                      |                                               |         "metrics_enabled": true,                                                                                                   
    |                                                      |                                               |         "cache_data_encrypted": true                                                                                               
    |                                                      |                                               |     },                                                                                                                             
    |                                                      |                                               |     "stage_name": "${aws_api_gateway_stage.named_test_resource.stage_name}",                                                       
    |                                                      |                                               |     "method_path": "*/*",                                                                                                          
    |                                                      |                                               |     "rest_api_id": "${aws_api_gateway_rest_api.test.id}"     
  • Add CHANGELOG for v0.1.0

    Add CHANGELOG for v0.1.0

    Integration test logs

    Logs
    Add passing integration test logs here
    

    Example query results

    Results
    Add example SQL query results here (please include the input queries as well)
    
  • Update golangci-lint workflow to the latest version and add stale workflow

    Update golangci-lint workflow to the latest version and add stale workflow

    Integration test logs

    Logs
    Add passing integration test logs here
    

    Example query results

    Results
    Add example SQL query results here (please include the input queries as well)
    
  • add an example to terraform_resource.md

    add an example to terraform_resource.md

    Show how to convert an argument's text to JSON and address within it

    Integration test logs

    Logs
    Add passing integration test logs here
    

    Example query results

    Results
    Add example SQL query results here (please include the input queries as well)
    
  • Update `tfConfigList` to remove the extra check to validate the exact match

    Update `tfConfigList` to remove the extra check to validate the exact match

    Integration test logs

    Logs
    Add passing integration test logs here
    

    Example query results

    Results
    Add example SQL query results here (please include the input queries as well)
    
  • Add information about go-getter support to `config/terraform.spc` example config file

    Add information about go-getter support to `config/terraform.spc` example config file

    Is your feature request related to a problem? Please describe. When viewing config/terraform.spc (or the copy that gets created locally when installing the plugin), it's not clear I can insert GitHub or S3 URLs.

    Describe the solution you'd like It should include a brief mention and link to the Hub site (https://hub.steampipe.io/plugins/turbot/terraform#supported-path-formats).

    Describe alternatives you've considered Viewing https://hub.steampipe.io/plugins/turbot/terraform#supported-path-formats.

    Additional context Add any other context or screenshots about the feature request here.

  • Add table terraform_module

    Add table terraform_module

    Add an additional table for terraform_module as tracked here #14

    Example query results

    steampipe query "select name, source, version from terraform_module"

    +----------+------------------------------------+---------+
    | name     | source                             | version |
    +----------+------------------------------------+---------+
    | eks      | terraform-aws-modules/eks/aws      | 18.7.2  |
    | key_pair | terraform-aws-modules/key-pair/aws | 1.0.1   |
    | eks_env  | cloudposse/label/null              | 0.25.0  |
    +----------+------------------------------------+---------+
    
    • as for the integration test logs etc: happy to provide / look into if somebody could advice what exactly is wanted.
  • Add table terraform_module

    Add table terraform_module

    Is your feature request related to a problem? Please describe. When using modules in my TF config files, the plugin does not parse them correctly

    Describe the solution you'd like Terraform plugin should know how to parse module blocks

    Describe alternatives you've considered None

    Additional context Module examples - https://www.terraform.io/language/modules/develop/composition

Use SQL to instantly query Hypothesis resources. Open source CLI. No DB required.

Hypothesis Plugin for Steampipe Prerequisites Steampipe Golang Build $ git clone https://github.com/judell/steampipe-plugin-hypothesis.git $ cd steam

Dec 11, 2022
Use SQL to instantly query users, groups, applications and more from Okta. Open source CLI. No DB required.
Use SQL to instantly query users, groups, applications and more from Okta. Open source CLI. No DB required.

Okta Plugin for Steampipe Use SQL to query infrastructure including users, groups, applications and more from Okta. Get started → Documentation: Table

Nov 10, 2022
Use SQL to instantly query instances, networks, databases, and more from Scaleway. Open source CLI. No DB required.
Use SQL to instantly query instances, networks, databases, and more from Scaleway. Open source CLI. No DB required.

Scaleway Plugin for Steampipe Use SQL to query infrastructure servers, networks, databases and more from your Scaleway project. Get started → Document

Nov 16, 2022
Use SQL to instantly query Algolia indexes and configuration. Open source CLI. No DB required

Use SQL to instantly query Algolia indexes and configuration. Open source CLI. No DB required

Oct 1, 2022
Use SQL to query host, DNS and exploit information using Shodan. Open source CLI. No DB required.

Shodan Plugin for Steampipe Query Shodan with SQL Use SQL to query host, DNS and exploit information using Shodan. For example: select * from shod

Nov 10, 2022
Use SQL to data from CSV files. Open source CLI. No DB required.
Use SQL to data from CSV files. Open source CLI. No DB required.

CSV Plugin for Steampipe Use SQL to query data from CSV files. Get started → Documentation: Table definitions & examples Community: Slack Channel Get

Nov 10, 2022
Use SQL to instantly query file, domain, URL and IP scanning results from VirusTotal.
Use SQL to instantly query file, domain, URL and IP scanning results from VirusTotal.

VirusTotal Plugin for Steampipe Use SQL to query file, domain, URL and IP scanning results from VirusTotal. Get started → Documentation: Table definit

Nov 10, 2022
Use SQL to query information including Users, Groups, Clients, Roles and more from Keycloak.

Keycloak Plugin for Steampipe [WIP] THIS IS NOT ACTIVE NOR WORKING YET - DO NOT USE Use SQL to query information including Users, Groups, Clients, Rol

Jan 6, 2023
Use SQL to query instances, domains and more from Prometheus.
Use SQL to query instances, domains and more from Prometheus.

Use SQL to instantly query Prometheus metrics, alerts, labels and more. Open source CLI. No DB required.

Nov 28, 2022
Use SQL to query databases, logs and more from PlanetScale

Use SQL to instantly query PlanetScale databases, branches and more. Open source CLI. No DB required.

Sep 30, 2022
This is the code example how to use SQL to query data from any relational databases in Go programming language.

Go with SQL example This is the code example how to use SQL to query data from any relational databases in Go programming language. To start, please m

Mar 12, 2022
Mergestat - a command-line tool for running SQL queries on git repositories and related data sources
Mergestat - a command-line tool for running SQL queries on git repositories and related data sources

Query git repositories with SQL. Generate reports, perform status checks, analyze codebases. ?? ??

Dec 30, 2022
OctoSQL is a query tool that allows you to join, analyse and transform data from multiple databases and file formats using SQL.
OctoSQL is a query tool that allows you to join, analyse and transform data from multiple databases and file formats using SQL.

OctoSQL OctoSQL is a query tool that allows you to join, analyse and transform data from multiple databases, streaming sources and file formats using

Dec 29, 2022
Parses a file and associate SQL queries to a map. Useful for separating SQL from code logic

goyesql This package is based on nleof/goyesql but is not compatible with it any more. This package introduces support for arbitrary tag types and cha

Oct 20, 2021
Steampipe plugin to query your Baleen namespaces, custom rules and more

Baleen plugin for Steampipe Use SQL to query namespaces, rules and more from Baleen. Get started → Documentation: Table definitions & examples Quick s

Jun 16, 2022
Go-Postgresql-Query-Builder - A query builder for Postgresql in Go

Postgresql Query Builder for Go This query builder aims to make complex queries

Nov 17, 2022
A Go SQL query builder and struct mapper.

godb - a Go query builder and struct mapper godb is a simple Go query builder and struct mapper, not a full-featured ORM. godb does not manage relatio

Dec 6, 2022
Query and Provision Cloud Infrastructure using an extensible SQL based grammar
Query and Provision Cloud Infrastructure using an extensible SQL based grammar

Deploy, Manage and Query Cloud Infrastructure using SQL [Documentation] [Developer Guide] Cloud infrastructure coding using SQL InfraQL allows you to

Oct 25, 2022
Dumpling is a fast, easy-to-use tool written by Go for dumping data from the database(MySQL, TiDB...) to local/cloud(S3, GCP...) in multifarious formats(SQL, CSV...).

?? Dumpling Dumpling is a tool and a Go library for creating SQL dump from a MySQL-compatible database. It is intended to replace mysqldump and mydump

Nov 9, 2022