# Automate Common Workflows

[Atmos Workflows](/workflows) combine multiple commands into executable units of work, ideal for automating common
tasks and orchestrating “cold starts,” where you bring an environment up from scratch.

Workflows can call other workflows and be combined with [Custom Commands](/cli/configuration/commands). Usually, we use
workflows to provision some combinations of [Terraform](/components/terraform) components.

Defining workflows is entirely optional; use them if they are helpful 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:
  ```yaml
  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.
  ```console
     │   # Centralized stacks configuration
     └── stacks/
         └── workflows/
             └── weather.yaml
  ```
  Add the following Atmos workflows to the `stacks/workflows/weather.yaml` file:
  ```yaml
  name: Workflows for Weather Station
  description: Atmos workflows for managing Weather Station

  workflows:

    plan-all:
      description: |
        Run 'terraform plan' on all 'station' components in all stacks
      steps:
        - command: terraform plan station -s dev
        - command: terraform plan station -s staging
        - command: terraform plan station -s prod

    apply-all:
      description: |
        Run 'terraform apply' on all 'station' components in all stacks
      steps:
        - command: terraform apply station -auto-approve -s dev
        - command: terraform apply station -auto-approve -s staging
        - command: terraform apply station -auto-approve -s prod
  ```

- ## - Run the Atmos Workflow
  Run the following Atmos commands to execute the workflows:
  ```shell
  # Execute the workflow `plan-all-vpc-flow-logs` from the workflow manifest `weather.yaml`
  atmos workflow plan-all -f weather

  # Execute the workflow `apply-all-components` from the workflow manifest `weather.yaml`
  atmos workflow apply-all -f weather
  ```
  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:
  ```shell
  Executing the workflow 'plan-all' from 'stacks/workflows/weather.yaml'

  Executing workflow step: terraform plan station -s dev
  Executing workflow step: terraform plan station -s staging
  Executing workflow step: terraform plan station -s prod
  ```

:::tip
Refer to [atmos workflow](/cli/commands/workflow) for more information on the `atmos workflow` CLI command
:::

**Want to go deeper on this topic?**

Workflows can do a lot more than we're showing here. Workflows support templates, and can call other workflows.
Learn More[Read more](/workflows)
