I have tried this and many variations.
includes:
- file: $(find-pkg-share my_package)/launch/optional_components.launch.yaml
condition:
value: $(var use_optional_component)
type: 'boolean'
I have trolled the source code (e.g. ros2/launch_yaml) and can't figure out where the relevant code is. But I would be happy to offer support for condition if it is not already provided.