Avoid coding in YAML. Use a DSL.

Configuration in YAML is fine, especially for non-full-time programmers.

But avoid coding in YAML (if conditions, looping, etc.). Use a DSL in a programming language instead.

Why? Because a DSL is not restricted (since it builds on top of a general-purpose language), and accomodates customization / complexity.

Plus, the DSL can generate the YAML, if the goal is to use YAML as the format of the input to the system.

An alternative to explore is CUE lang (via).