steampipe plugin install env0steampipe plugin install env0

env0 + Steampipe

env0 is an automation platform for cloud environments based on infrastructure-as-code templates. env0 combines an easy to use interface with powerful governance tools and cost control so that you, or any member of your team, can quickly and easily deploy and manage environments in the cloud.

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

List your env0 organization details:

select
name,
id,
created_by,
created_at,
description,
role
from
env0_organization;
+--------+--------------------------------------+-------------------------------------+---------------------------+-------------------+-------+
| name | id | created_by | created_at | description | role |
+--------+--------------------------------------+-------------------------------------+---------------------------+-------------------+-------+
| My org | 20a6g055-c90e-3630-9121-a89274f71324 | google-oauth2|116303011440913654789 | 2023-04-26T18:21:33+05:30 | code deployment | Admin |
+--------+--------------------------------------+-------------------------------------+---------------------------+-------------------+-------+

Documentation

Quick start

Install

Download and install the latest env0 plugin:

steampipe plugin install env0

Credentials

ItemDescription
Credentialsenv0 requires an API Key and an API Secret for all requests.
PermissionsThe organization administrator creates the API keys and assigns a role to it. If the role assignment changes then the permission level of API keys also change.
RadiusEach connection represents a single env0 organization.
Resolution1. Credentials explicitly set in a steampipe config file (~/.steampipe/config/env0.spc)
2. Credentials specified in environment variables, e.g., ENV0_API_KEY, ENV0_API_SECRET.
3. Credentials from the env0 CLI configuration file.

Configuration

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

Configure your account details in ~/.steampipe/config/env0.spc:

connection "env0" {
plugin = "env0"
# For setting API key and secret see instructions at https://docs.env0.com/reference/authentication
# `api_key`: The API key for the env0 account. (Required)
# This can also be set via the `ENV0_API_KEY` environment variable.
# api_key = "asdpoblfth8acbd"
# `api_secret`: The API secret of the env0 account. (Required)
# This can also be set via the `ENV0_API_SECRET` environment variable.
# api_secret = "LjatOxDqNN9iKH1sLn14TojGkuH3GQAx"
# If no credentials are specified, the plugin will use env0 CLI configuration, if it has been installed locally.
}

Alternatively, you can also use the standard env0 environment variables to obtain credentials only if other arguments (api_key and api_secret) are not specified in the connection:

export ENV0_API_KEY=asdpoblfth8acbd
export ENV0_API_SECRET=LjatOxDqNN9iKH1sLn14TojGkuH3GQAx

)

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)" -- env0

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_env0;
CREATE SERVER steampipe_env0 FOREIGN DATA WRAPPER steampipe_postgres_env0 OPTIONS (config '<your_config>');
CREATE SCHEMA env0;
IMPORT FOREIGN SCHEMA env0 FROM SERVER steampipe_env0 INTO env0;

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)" -- env0

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_env0 function to configure it with plugin-specific options.

$ sqlite3
sqlite> .load ./steampipe_sqlite_extension_env0.so
sqlite> select steampipe_configure_env0('<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)" -- env0

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

steampipe_export_env0 --config '<your_config>' <table_name>