Skip to main content

Conditional enablement of stacks within templates

We would like the ability to conditionally enable or disable stacks defined in a template based on input values.

A common use case is selectively deploying optional components, for example via a boolean input such as enable_service_x. When set to false, the corresponding stack should not be created or executed.

This becomes particularly important in templates that define multiple related stacks, where some components are optional depending on environment, tenant, or feature flags.

Expected behaviour:

  • Stacks can be conditionally included or excluded based on template inputs.

  • Disabled stacks are treated as if they do not exist for that run.

  • Any dependencies referencing a disabled stack are ignored rather than causing errors.

  • The dependency graph is resolved dynamically after conditions are evaluated.

Workaround
None
Problem
Status: 🔭 Discovery1 comment

This request was merged into another request

Comments1

  • Crimson Toaster

    •

    May 6

    This feature is critical for us. The lack of conditional enablement of stacks within templates is currently blocking our migration from GitLab CI to Spacelift.

    In GitLab, we rely heavily on conditional job execution to control which parts of our pipeline run based on context. Without an equivalent capability in Spacelift templates, we can’t replicate our existing workflows.

    We would greatly appreciate prioritisation of this feature, as it is a key requirement for adoption.