Automate Common Workflows
Atmos Workflows combine multiple commands into executable units of work, which makes them useful for packaging the commands your operators run every day.
Workflows can call other workflows and be combined with Custom Commands. Usually, we use workflows to orient operators, validate configuration, or wrap a common sequence of built-in Atmos commands.
Defining workflows is entirely optional. You already learned how to deploy the stack with atmos terraform deploy --all -s dev; use workflows when
you want to package that guidance for your project.
Configure Your Project to Support Workflows
To define workflows, update your atmos.yaml to tell it where to find your workflows.
Add the following workflows section and configure the base path to the workflows:
workflows:
# Can also be set using 'ATMOS_WORKFLOWS_BASE_PATH' ENV var, or '--workflows-dir' command-line arguments
# Supports both absolute and relative paths
base_path: "stacks/workflows"
Create an Atmos Workflow
Now, let's create a workflow in the stacks/workflows directory.
Add the following Atmos workflow to the stacks/workflows/weather.yaml file:
name: Workflows for Weather Station
description: Operator workflows for managing Weather Station
workflows:
operator/orient:
description: |
Show the stack list, component instances, validation command, and
day-to-day commands an operator uses for this quick-start stack.
steps:
- name: stacks
type: stage
title: Stack list
- name: show-stacks
command: list stacks
- name: instances
type: stage
title: Component instances
- name: show-instances
command: list instances
- name: commands
type: table
title: Quick-start operator commands
columns:
- task
- command
data:
- task: Validate manifests
command: atmos validate stacks
- task: Preview stack
command: atmos terraform plan --all -s <stack>
- task: Deploy stack
command: atmos terraform deploy --all -s <stack>
- task: Destroy stack
command: atmos terraform destroy --all -s <stack> -auto-approve
Run the Atmos Workflow
Run the workflow for the dev stack:
atmos workflow operator/orient -f weather -s dev
The atmos workflow CLI command supports the --dry-run flag. If passed, the command will just print information about
the executed workflow steps without executing them. For example:
For bulk Terraform operations, keep using explicit selectors such as --all, --components, or --query. Refer to
atmos workflow for more information on the atmos workflow CLI command.
Workflows can do a lot more than we're showing here. Workflows support templates, and can call other workflows. Learn More