turbot/consul

GitHub
steampipe plugin install consulsteampipe plugin install consul

Consul + Steampipe

Consul is a service networking solution to automate network configurations, discover services, and enable secure connectivity across any cloud or runtime.

Steampipe is an open source CLI to instantly query cloud APIs using SQL.

List your Consul services:

select
service_id,
service_name,
node,
address,
datacenter,
namespace
from
consul_service;
+------------------------------------------------+--------------+------------------+---------------+------------+-----------+
| service_id | service_name | node | address | datacenter | namespace |
+------------------------------------------------+--------------+------------------+---------------+------------+-----------+
| consul | consul | ip-172-31-30-170 | 172.31.30.170 | dc1 | default |
+------------------------------------------------+--------------+------------------+---------------+------------+-----------+

Documentation

Quick start

Install

Download and install the latest Consul plugin:

steampipe plugin install consul

Credentials

ItemDescription
CredentialsConsul requires an Address or Address and Token for all requests.
PermissionsThe permission scope of tokens is set by the Admin at the creation time of the ACL tokens.
RadiusEach connection represents a single Consul Installation.
Resolution1. Credentials explicitly set in a steampipe config file (~/.steampipe/config/consul.spc)
2. Credentials specified in environment variables, e.g., CONSUL_HTTP_ADDR and CONSUL_HTTP_TOKEN.

Configuration

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

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

connection "consul" {
plugin = "consul"
# Address is required for requests. Required.
# This can also be set via the CONSUL_HTTP_ADDR environment variable.
# address = "http://52.14.112.248:8500"
# An ACL token is required for ACL-enabled Consul servers. Optional.
# For more information on the ACL Token, please see https://developer.hashicorp.com/consul/docs/security/acl/acl-tokens.
# This can also be set via the CONSUL_HTTP_TOKEN environment variable.
# token = "c178b810-8b18-6f38-016f-725ddec5d58"
# Namespace is required for Consul Enterprise access. Optional.
# API will execute with default namespace if this parameter is not set.
# This can also be set via the CONSUL_NAMESPACE environment variable.
# "*" indicates all the namespaces available.
# namespace = "*"
# Partition is required for Consul Enterprise access. Optional.
# API will execute with default partition if this parameter is not set.
# This can also be set via the CONSUL_PARTITION environment variable.
# partition = "default"
}
  • token parameter is only required to query the ACL tables like consul_acl_auth_method, consul_acl_binding_rule, consul_acl_policy, consul_acl_role and consul_acl_token tables.
  • namespace, and partition parameters are only required to query the consul_namespace table.

Alternatively, you can also use the standard Consul environment variable to obtain credentials only if other arguments (address, token, namespace, and partition) are not specified in the connection:

export CONSUL_HTTP_ADDR=http://18.118.144.168:4646
export CONSUL_HTTP_TOKEN=c178b810-8b18-6f38-016f-725ddec5d58
export CONSUL_NAMESPACE=*
export CONSUL_PARTITION=default

Get involved