steampipe plugin install heroku

Heroku + Steampipe

Heroku is a cloud platform as a service (PaaS) supporting several programming languages.

Steampipe is an open-source zero-ETL engine to instantly query cloud APIs using SQL.

List instances in your Heroku account:

select
name,
web_url,
updated_at
from
heroku_app
+--------+-------------------------------+---------------------+
| name | web_url | updated_at |
+--------+-------------------------------+---------------------+
| my-app | https://my-app.herokuapp.com/ | 2021-08-28 18:44:51 |
+--------+-------------------------------+---------------------+

Documentation

Get started

Install

Download and install the latest Heroku plugin:

steampipe plugin install heroku

Credentials

No credentials are required.

Configuration

Installing the latest heroku plugin will create a config file (~/.steampipe/config/heroku.spc) with a single connection named heroku:

connection "heroku" {
plugin = "heroku"
email = "ryan@dundermifflin.com"
api_key = "34c12972-9d18-421c-3ae5-5293ae1507be"
}
  • email - Email address of the Heroku user.
  • api_key - API key (or password) of the Heroku user.

Multi-Account Connections

You may create multiple heroku connections:

connection "heroku_dev" {
plugin = "heroku"
email = "ryan@dundermifflin.com"
api_key = "34c12972-9d18-654c-3ae5-5293ae1889be"
}
connection "heroku_qa" {
plugin = "heroku"
email = "ryan@dundermifflin.com"
api_key = "34c12972-9d18-654c-3ae5-5293ae1905be"
}
connection "heroku_prod" {
plugin = "heroku"
email = "ryan@dundermifflin.com"
api_key = "34c12972-9d18-654c-3ae5-5293ae1124be"
}

Each connection is implemented as a distinct Postgres schema. As such, you can use qualified table names to query a specific connection:

select
*
from
heroku_qa.heroku_team_member

You can create multi-account connections by using an aggregator connection. Aggregators allow you to query data from multiple connections for a plugin as if they are a single connection.

connection "heroku_all" {
plugin = "heroku"
type = "aggregator"
connections = ["heroku_dev", "heroku_qa", "heroku_prod"]
}

Querying tables from this connection will return results from the heroku_dev, heroku_qa, and heroku_prod connections:

select
*
from
heroku_all.heroku_team_member

Alternatively, you can use an unqualified name and it will be resolved according to the Search Path. It's a good idea to name your aggregator first alphabetically so that it is the first connection in the search path (i.e. heroku_all comes before heroku_dev):

select
*
from
heroku_team_member

Steampipe supports the * wildcard in the connection names. For example, to aggregate all the heroku plugin connections whose names begin with heroku_:

connection "heroku_all" {
type = "aggregator"
plugin = "heroku"
connections = ["heroku_*"]
}

Postgres FDW

This plugin is available as a native Postgres FDW. Unlike Steampipe CLI, which ships with an embedded Postgres server instance, the Postgres FDW can be installed in any supported Postgres database version.

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

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

The installer will prompt you for the plugin name and version, download and install the appropriate files for your OS, system architecture, and Postgres version.

To configure the Postgres FDW, you will create an extension, foreign server, and schema and import the foreign schema.

CREATE EXTENSION IF NOT EXISTS steampipe_postgres_heroku;
CREATE SERVER steampipe_heroku FOREIGN DATA WRAPPER steampipe_postgres_heroku OPTIONS (config '<your_config>');
CREATE SCHEMA heroku;
IMPORT FOREIGN SCHEMA heroku FROM SERVER steampipe_heroku INTO heroku;

SQLite Extension

This plugin is available as a SQLite Extension, making the tables available as SQLite virtual tables.

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

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

The installer will prompt you for the plugin name, version, and destination directory. It will then determine the OS and system architecture, and it will download and install the appropriate package.

To configure the SQLite extension, load the extension module and then run the steampipe_configure_heroku function to configure it with plugin-specific options.

$ sqlite3
sqlite> .load ./steampipe_sqlite_extension_heroku.so
sqlite> select steampipe_configure_heroku('<your_config>');

Export

This plugin is available as a standalone Export 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)" -- heroku

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

steampipe_export_heroku --config '<your_config>' <table_name>