Table: env0_template - Query env0 Templates using SQL
An env0 Template is a predefined infrastructure as code (IaC) template that can be used to create and manage resources on the env0 platform. These templates are typically written in Terraform or Terragrunt, and define the infrastructure components needed for an application. The templates are reusable, version-controlled, and can be parameterized to create unique environments based on the same template.
Table Usage Guide
The env0_template
table provides insights into the infrastructure as code (IaC) templates used within the env0 platform. As a DevOps engineer, you can explore template-specific details through this table, including the template's name, version, and associated parameters. Utilize it to manage and understand the infrastructure components defined in each template, allowing for better control and visibility over your env0 environments.
Examples
Basic info
Explore which templates are created by whom and when, along with their associated organizations and projects. This could be useful to understand how your infrastructure as code templates are being used across different enterprise version control systems.
select name, id, author, created_at, organization_id, is_github_enterprise, is_gitlab_enterprise, project_ids, terraform_versionfrom env0_template;
select name, id, author, created_at, organization_id, is_github_enterprise, is_gitlab_enterprise, project_ids, terraform_versionfrom env0_template;
List templates created in the last 30 days
Discover the segments that have been recently added by identifying templates created within the past month. This can help keep track of new additions and understand recent changes in your environment.
select name, id, author, created_at, organization_id, is_github_enterprise, is_gitlab_enterprise, project_ids, terraform_versionfrom env0_templatewhere created_at >= now() - interval '30' day;
select name, id, author, created_at, organization_id, is_github_enterprise, is_gitlab_enterprise, project_ids, terraform_versionfrom env0_templatewhere created_at >= datetime('now', '-30 day');
List templates that have not been updated in the last 30 days
Assess the elements within your environment to identify any templates that haven't been updated in the past month. This can be useful to ensure all templates are up-to-date and adhere to current standards or practices.
select name, id, author, created_at, organization_id, is_github_enterprise, is_gitlab_enterprise, project_ids, terraform_versionfrom env0_templatewhere updated_at >= now() - interval '30' day;
select name, id, author, created_at, organization_id, is_github_enterprise, is_gitlab_enterprise, project_ids, terraform_versionfrom env0_templatewhere updated_at >= datetime('now', '-30 day');
List templates that uses GitHub or GitLab enterprise
Explore the templates created for organizations that utilize either GitHub or GitLab enterprise versions. This is particularly useful for identifying and analyzing the use of these enterprise platforms in your projects.
select name, id, author, created_at, organization_id, project_ids, terraform_versionfrom env0_templatewhere is_github_enterprise or is_gitlab_enterprise;
select name, id, author, created_at, organization_id, project_ids, terraform_versionfrom env0_templatewhere is_github_enterprise = 1 or is_gitlab_enterprise = 1;
Schema for env0_template
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form, e.g. connection_name. | |
author | text | Name of the author of the template. | |
author_id | text | Unique identifier of the author. | |
bitbucket_client_Key | text | The Bitbucket client key used by template. | |
created_at | timestamp with time zone | The date and time when template was created | |
description | text | Description associated with the template. | |
file_name | text | File name associated with template. | |
github_installation_id | bigint | The GitHub installation of the template. | |
href | text | Href link to the template. | |
id | text | = | Unique identifier of the template. |
is_azure_devops | boolean | Specifies whether the template is associated with Azure DevOps deployment. | |
is_bitbucket_server | boolean | Specifies whether or not template is using Bitbucket server. | |
is_deleted | boolean | Specifies whether or not the template is deleted. | |
is_github_enterprise | boolean | Specifies whether or not template belongs to GitHub enterprise. | |
is_gitlab_enterprise | boolean | Specifies whether or not template belongs to GitLab enterprise. | |
is_terragrunt_run_all | boolean | Specifies whether or not terragrunt will execute all the modules associated with the template. | |
name | text | Name of the template. | |
organization_id | text | The organization ID in which the resource is located. | |
path | text | The Path of the template. | |
project_id | text | The associated project id with the template. | |
project_ids | jsonb | The associated projects id with the template. | |
repository | text | The associated version control repository with the template. | |
retry | jsonb | Retry associated with the template. | |
revision | text | Revision of the template. | |
ssh_keys | jsonb | The associated ssh keys with the template. | |
terraform_version | text | Terraform version associated with the template. | |
terragrunt_version | text | Specifies the version of terragrunt that should be used when running a terraform deployment by the template. | |
title | text | Title of the resource. | |
token_id | text | Token ID associated with the template. | |
type | text | Type of the template. | |
updated_at | timestamp with time zone | The date and time when template was updated |
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_template