Create a New Workflow

To set up a Workflow follow this simple guide:

env0 relies on a file named env0.workflow.yml to describe the dependencies and configuration of the sub environments in your workflow. Each environment definition in the file should contain:

  1. name: Will be displayed in the workflow graph
  2. templateName(optional, conflict with vcs): A name of a pre-defined Template to deploy


    Template Naming

    While we don't enforce it, the best practice is to use unique template names.
    Otherwise, the workflow will randomly choose one of the templates, without considering any permission restrictions.

  3. vcs(optional, conflict with templateName): information to integrate with the VCS and all the information used to create a Template
  4. needs (optional): An array of sub environments which all must be successfully deployed before this sub environment can start deploying
  5. revision: (optional) A revision for this specific environment's Template to deploy.
  6. workspace (optional): A name for the terraform workspace for a new environment.
    Note: The workspace attribute can not be set for an existing environment.
  7. disabled (optional): Setting it to true will make it so this particular environment will not participate in this workflow. Combined with the ability to set environment variables, this is handy in allowing for partial workflow deployments.
    name: 'VPC and Network'
    templateName: 'VPC'
    name: DB
    templateName: 'DB'
      - vpc
    name: EKS
    templateName: 'EKS'
      - vpc
    name: 'Billing Service'
      type: 'terraform'
      terraformVersion: '1.5.7'
      repository: ''
      path: 'aws/hello-world'
      githubInstallationId: 123456789
      # bitbucketClientKey for bitbucket
      # gitlabProjectId for gitlab
    disabled: ${DISABLE_SERVICE_1}   # omit service1 deployment,
                                     # if the interpolated env var DISABLE_SERVICE_1 is true
      - db
      - eks
    name: 'Configuration Service'
    templateName: 'Configuration Service' 
    revision: feature-branch
    disabled: ${DISABLE_SERVICE_2}
      - db
      - eks
    name: 'Notification Service'
    templateName: 'Notification Service'
    workspace: env0-workspace
    disabled: ${DISABLE_SERVICE_3}
      - db
      - eks


Removing Environment

Please note that by default removing an environment from the workflow file and redeploying the environment is not supported, and your environment will be left stranded.

If you would like env0 to destroy the removed environments you need to add settings section to your env0.workflow.yml


    name: 'VPC and Network'
    templateName: 'VPC'
	environmentRemovalStrategy: destroy | detach

By setting environmentRemovalStrategy as destroy env0 will automatically destroy the removed environments after deploying all environments

Creating a Workflow in the UI

  1. Create a new Template and select env0 Workflow as the Template Type

In the VCS step, fill in your VCS details and the directory that contains your env0.workflow.yml file

  1. Create an Environment based on the Workflow template.
    You can choose any of the workflow environments from the dropdown box at the top right corner.

After choosing one of the workflow sub-environment you can modify its Environment's variables, workspace and revision.


Remote Backend

The Remote backend option will be applied only for Terraform Templates. For further documentation about remote backend follow this.


Overrides Note

The values you set here for workspace and revision will override the ones you defined in the workflow file for the corresponding environment.

if you would like to set the whole workflow to the the same workspace name value, you can do so by setting the workflow workspace name, and leaving the sub environments blank.

note that since Terragrunt uses a working directory instead of workspace name, the workspace name override won't apply to Terragrunt template type.

When marking the workflow as remote backend, you must provide unique names for each of the sub environments workspaces.

  1. Deploy