Blueprints

Switch tasks depending on a specific value

Source

yaml
id: switch
namespace: company.team

inputs:
  - id: string
    type: STRING

tasks:
  - id: switch
    type: io.kestra.plugin.core.flow.Switch
    value: "{{ inputs.string }}"
    cases:
      A:
        - id: a
          type: io.kestra.plugin.core.debug.Return
          format: The input is {{ inputs.string }}
      B:
        - id: b
          type: io.kestra.plugin.core.debug.Return
          format: The input is {{ inputs.string }}
    defaults:
      - id: default
        type: io.kestra.plugin.core.debug.Return
        format: This is the default case

About this blueprint

The switch task will drive the flow depending of the input value.

Switch

Return

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra