My experience with yml based builds and deployments is basically using the yml file to tell the build system what code to run to do the build - usually other shell scripts or some other scripting language that can also be in the same git repo.
It’s a namespace with the values you want inline, in my head
They’re INI files or .cfg to me
Not code
The code is the Python in Ansible, or Go in TF, that applies those values
Using config mgmt tools like they’re vanilla programming languages is weird.