Workflows

What is a Workflow?

A workflow is an Environment which instead of managing a single IaC stack, it manages multiple IaC stacks and their respective dependencies.
A workflow is essentially a wrapper around Environments, Workflows allow deploying many Environments with complex dependencies between them as a single unit.

A Workflow example

A Workflow example

When Should You Use Workflows?

A production appโ€™s infrastructure consists of many different resources. As those resources grow, managing and deploying them requires more thought and effort.

We tend to look at managing resources as we do with code - split them into smaller manageable pieces (Environments) where each piece is cohesive and loosely coupled.

In theory, this textbook solution sounds great because each environment is independent and can be deployed at any time but In the real world, we have dependencies - deploying all those Environments simultaneously is impractical.

๐Ÿ“˜

Basic Dependency Example

Environment "Network and VPC" manages all necessary network configuration.
Environment "DB" manages a database that multiple services use.
Environment "EKS" manages the Elastic Kubernetes Service onto which pods of services will be deployed.
Environments "Billing Service"", "Configuration Service" and "Notification Service" all manage the deployments of services on EKS. Those services need access to the database.

For this use case:
Environment "DB" depends on the VPC from the "Network and VPC" IaC stack.
Environment "EKS" also depends on the VPC from the "Network and VPC" IaC stack.
All service environments depend on DB, and EKS

As can be seen, the dependencies make it impossible for all the Environments to be deployed simultaneously.

And of course, as the resources and environments grow the complexity of the dependencies will increase.

Workflows will help you manage and deploy your environments with their dependencies.

Workflow Environment Status

A Workflow Environment can be in one of the following states:

Active - all sub environments are successfully deployed, and up and running.
Inactive - all sub-environments are successfully destroyed, manually or automatically.
Deploy in progress - currently being deployed.
Destroy in progress - currently being destroyed.
Failed - errors were encountered during deployment in at least 1 sub environment

๐Ÿ‘

Workflow benefits

  1. Manage your entire infrastructure with complex dependencies between Environments
  2. Visual presentation of the complex deployment
  3. Each environment can use a different IaC tool - one environment can be managed by Terraform while another is managed by K8S
  4. Enhanced experience from all surrounding env0 features such as Policies, Custom flows, Drift Detection and Continuous Deployment.

Environment Variables

If you'd like to pass Environment Variables to all IaC stacks in the workflow.

To do that, simply add/edit environment variables when deploying the workflow.

If you'd like to set some specific environment variable for a specific environment in the workflow, you'd have to redeploy that specific environment, and add/edit that environment variable