Skip to main content
This page provides a complete reference for the env0.workflow.yaml (or .yml) file used to define env zero Workflows.

File Structure

The workflow file has two main sections:
  • environments (required) - Defines the sub-environments in the workflow
  • settings (optional) - Global workflow settings
Example:
env0.workflow.yaml
settings:
  environmentRemovalStrategy: detach # or destroy

environments:
  my-environment:
    name: "My Environment"
    templateName: "my-template"
    # ... additional configuration

Settings

Global settings that apply to the entire workflow. environmentRemovalStrategy (string) controls what happens when a sub-environment is removed from the workflow file.
  • Default: detach
  • detach - The environment is detached but not destroyed.
  • destroy - The environment is destroyed after you deploy the updated workflow.

Sub-Environment Properties

Each sub-environment is defined as a key-value pair under environments. The key is a unique alias for the sub-environment.

Core Properties

PropertyTypeRequiredDescription
namestringYesDisplay name shown in the env zero UI.
templateNamestringNo*Name of an existing env zero template. Cannot be used with vcs.
vcsobjectNo*Inline VCS configuration. Cannot be used with templateName.
* Either templateName or vcs must be specified, but not both.

Optional Properties

PropertyTypeDefaultDescription
needsarray[]List of sub-environment aliases that must deploy before this one.
revisionstring-Git revision (branch, tag, or commit SHA) to use.
workspacestring-For Terraform/OpenTofu, sets the workspace name. For Helm, sets the release name. For Pulumi/CloudFormation, sets the stack name.
requiresApprovalbooleanfalseIf true, deployment requires manual approval before proceeding.
disabledboolean or stringfalseIf true or "true", this sub-environment is skipped during deployment. Supports variable interpolation.

VCS Configuration

If you want to use your code directly without creating a template for it first, you can use the vcs object with the following properties:
PropertyTypeRequiredDefaultDescription
typestringYes-IaC type. Options: terraform, opentofu, terragrunt, pulumi, k8s, cloudformation, helm, ansible.
repositorystringYes-Git repository URL (HTTPS or SSH).
pathstringNo""Path within the repository where IaC code is located.
revisionstringNo-Git revision (branch, tag, or commit) to use.

VCS Authentication Properties

PropertyTypeDescription
tokenIdstringID of a stored VCS token for authentication.
tokenNamestringDisplay name of the VCS token.
sshKeysarraySSH keys for repository authentication. Each item requires id and name.
githubInstallationIdnumberGitHub App installation ID.
bitbucketClientKeystringBitbucket client key for Bitbucket Cloud.
vcsConnectionIdstringVCS connection ID for unified VCS integration.

VCS Provider Flags

PropertyTypeDefaultDescription
isGitLabbooleanfalseSet to true for GitLab.com repositories.
isGitLabEnterprisebooleanfalseSet to true for GitLab Enterprise/self-hosted.
isGitHubEnterprisebooleanfalseSet to true for GitHub Enterprise.
isBitbucketServerbooleanfalseSet to true for Bitbucket Server/Data Center.
isAzureDevOpsbooleanfalseSet to true for Azure DevOps.

IaC Version Properties

PropertyTypeDescription
terraformVersionstringTerraform version. Use a specific version (e.g., 1.5.7) or RESOLVE_FROM_TERRAFORM_CODE.
opentofuVersionstringOpenTofu version. Use a specific version (e.g., 1.6.0).
terragruntVersionstringTerragrunt version (e.g., 0.54.0).
terragruntTfBinarystringUnderlying binary for Terragrunt: terraform (default) or opentofu.
pulumiVersionstringPulumi version (e.g., 3.100.0).
ansibleVersionstringAnsible version (e.g., 2.15.0).

CloudFormation Properties

PropertyTypeDefaultDescription
helmChartNamestring-Helm chart name when using a Helm repository.
isHelmRepositorybooleanfalseSet to true if the repository is a Helm chart repository.

Helm Properties

PropertyTypeDefaultDescription
helmChartNamestring-Helm chart name when using a Helm repository.
isHelmRepositorybooleanfalseSet to true if the repository is a Helm chart repository.

Examples

Simple Workflow with Template References

A basic workflow using pre-defined templates with dependencies.
env0.workflow.yaml
environments:
  database:
    name: "PostgreSQL Database"
    templateName: "aws-rds-postgres"
    workspace: "production"

  api:
    name: "API Service"
    templateName: "kubernetes-deployment"
    needs:
      - database
    requiresApproval: true

Workflow with Inline VCS Configuration

Define IaC source directly without creating separate templates:
env0.workflow.yaml
environments:
  networking:
    name: "VPC and Networking"
    vcs:
      type: terraform
      repository: "https://github.com/myorg/infrastructure"
      path: "terraform/networking"
      terraformVersion: "1.5.7"

  compute:
    name: "EC2 Instances"
    vcs:
      type: terraform
      repository: "[email protected]:myorg/infrastructure.git"
      path: "terraform/compute"
      terraformVersion: "RESOLVE_FROM_TERRAFORM_CODE"
      sshKeys:
        - id: "ssh-key-123"
          name: "Deploy Key"
    needs:
      - networking

Mixed Workflow with Settings

Combine template references and inline VCS with global settings.
env0.workflow.yaml
settings:
  environmentRemovalStrategy: remove

environments:
  infra:
    name: "Base Infrastructure"
    templateName: "terraform-aws-base"
    revision: "v2.0.0"

  app:
    name: "Application"
    vcs:
      type: helm
      repository: "https://github.com/myorg/helm-charts"
      path: "charts/myapp"
    needs:
      - infra

  monitoring:
    name: "Monitoring Stack"
    templateName: "prometheus-grafana"
    needs:
      - infra
    disabled: false

Workflow with Variable Interpolation

Use environment variables to conditionally disable sub-environments.
env0.workflow.yaml
environments:
  vpc:
    name: "VPC and Network"
    templateName: "VPC"

  db:
    name: "Database"
    templateName: "DB"
    requiresApproval: true
    needs:
      - vpc

  eks:
    name: "EKS Cluster"
    templateName: "EKS"
    needs:
      - vpc

  billing-service:
    name: "Billing Service"
    templateName: "Billing Service"
    disabled: ${DISABLE_BILLING_SERVICE}
    needs:
      - db
      - eks

  config-service:
    name: "Configuration Service"
    templateName: "Configuration Service"
    revision: feature-branch
    disabled: ${DISABLE_CONFIG_SERVICE}
    needs:
      - db
      - eks
Use variable interpolation with the disabled property to enable partial workflow deployments based on environment variables.
Learn more: Workflow File JSON Schema