steampipe plugin install env0

Table: env0_environment - Query Env0 Environments using SQL

Env0 is a self-service cloud management platform that provides infrastructure as code (IaC) environments on demand. It allows teams to manage and provision their own environments, while maintaining control and governance. Env0 supports multiple IaC frameworks and cloud providers, enabling teams to use their preferred technologies and processes.

Table Usage Guide

The env0_environment table provides insights into Environments within Env0. As a DevOps engineer, you can explore environment-specific details through this table, including the environment's ID, name, project ID, and other related data. Use it to uncover information about environments, such as their current status, the associated project, and the last time they were updated.

Examples

Basic info

Explore which environments require approval for changes and identify instances where continuous deployment is enabled. This can aid in understanding the management and control mechanisms in place for your projects.

select
name,
id,
project_id,
continuous_deployment,
pull_request_plan_deployments,
requires_approval,
is_archived
from
env0_environment;
select
name,
id,
project_id,
continuous_deployment,
pull_request_plan_deployments,
requires_approval,
is_archived
from
env0_environment;

List environments which are not in archived state

Discover the environments that are currently active and not archived. This can be useful for maintaining an overview of all ongoing projects and ensuring that resources are not being wasted on inactive environments.

select
name,
id,
project_id,
continuous_deployment,
pull_request_plan_deployments,
requires_approval,
status,
workspace_name,
is_archived
from
env0_environment
where
not is_archived;
select
name,
id,
project_id,
continuous_deployment,
pull_request_plan_deployments,
requires_approval,
status,
workspace_name,
is_archived
from
env0_environment
where
not is_archived;

List inactive environments

Explore which environments are inactive in your project, helping you identify areas for clean-up or potential resource optimization. This is useful in managing resources and maintaining an efficient, organized environment structure.

select
name,
id,
project_id,
continuous_deployment,
pull_request_plan_deployments,
requires_approval,
status,
workspace_name,
is_archived
from
env0_environment
where
status <> 'Active';
select
name,
id,
project_id,
continuous_deployment,
pull_request_plan_deployments,
requires_approval,
status,
workspace_name,
is_archived
from
env0_environment
where
status <> 'Active';

List environments that bypass approval requirement from an authorized user

Explore which environments are set to bypass the approval requirement, allowing for a more streamlined deployment process and potentially reducing bottlenecks. This can be beneficial in scenarios where rapid deployment is critical.

select
name,
id,
project_id,
continuous_deployment,
pull_request_plan_deployments,
requires_approval,
status,
workspace_name,
is_archived
from
env0_environment
where
not requires_approval;
select
name,
id,
project_id,
continuous_deployment,
pull_request_plan_deployments,
requires_approval,
status,
workspace_name,
is_archived
from
env0_environment
where
not requires_approval;

List environments that do not implement continuous deployment

Determine the areas in your project where continuous deployment is not implemented. This can help identify potential bottlenecks in your development process and areas for improvement.

select
name,
id,
project_id,
continuous_deployment,
pull_request_plan_deployments,
requires_approval,
status,
workspace_name,
is_archived
from
env0_environment
where
not continuous_deployment;
select
name,
id,
project_id,
continuous_deployment,
pull_request_plan_deployments,
requires_approval,
status,
workspace_name,
is_archived
from
env0_environment
where
continuous_deployment = 0;

Get the log details of the latest deployment

Explore the latest deployment's log details to identify if there were any issues or irregularities. This is particularly useful in situations where continuous deployment is not used, allowing for more thorough tracking and troubleshooting of each deployment.

select
name,
id,
project_id,
workspace_name,
is_archived,
latest_deployment_log ->> 'Id' as latest_deployment_log_id,
latest_deployment_log ->> 'BlueprintId' as latest_deployment_log_blueprint_id,
latest_deployment_log ->> 'Type' as latest_deployment_log_type
from
env0_environment
where
not continuous_deployment;
select
name,
id,
project_id,
workspace_name,
is_archived,
json_extract(latest_deployment_log, '$.Id') as latest_deployment_log_id,
json_extract(latest_deployment_log, '$.BlueprintId') as latest_deployment_log_blueprint_id,
json_extract(latest_deployment_log, '$.Type') as latest_deployment_log_type
from
env0_environment
where
not continuous_deployment;

Schema for env0_environment

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
auto_deploy_by_custom_globtextSpecifies a custom glob pattern that determines which files should trigger an automatic deployment when changes are detected.
auto_deploy_on_path_changes_onlybooleanSpecifies whether or not automatic deployments of infrastructure changes should be triggered only when changes are made to specific files or directories.
blueprint_idtextSpecifies the ID of the blueprint associated with the environment.
continuous_deploymentbooleanSpecifies whether or not continuous deployment value is set in the environment.
idtext=The number uniquely identifying the environment.
is_archivedbooleanSpecifies whether an environment is set to archived or not.
is_remote_backendbooleanSpecifies whether the Terraform backend configuration uses a remote backend or not.
latest_deployment_logjsonbThe most recent deployment log for a specific environment or deployment.
latest_deployment_log_idtextRepresents the ID of the most recent deployment log.
lifespan_end_attimestamp with time zoneRepresents the end time of an environment's lifespan
nametextThe name of the environment.
project_idtextA unique ID of the project.
pull_request_plan_deploymentsbooleanSpecifies whether automatic deployments of infrastructure change is enabled when a pull request is created or updated.
requires_approvalbooleanA boolean value indicating whether changes to the environment require approval before they can be applied.
statustextThe status of the environment.
terragrunt_working_directorytextSpecifies the directory where Terragrunt will look for the terragrunt.hcl configuration file.
titletextTitle of the resource.
vcs_commands_aliastextSpecifies alias for the VCS commands used for deploying infrastructure changes.
workspace_nametextThe name of the workspace associated to the environment.

Export

This table is available as a standalone Exporter 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>' env0_environment