You can list a directory, read all the json that dir (in a single list/map comprehension/building expression) and use that to feed your modules that manage the actual terraform resources.
When you realize that terraform modules are functions, terraform become a usable functional language.
Why would I want to generate some terraform when I can simply use it to generate the desired state using my higher level data ?
> terraform modules are functions
You seem to have found this feature useful. Doesn't that answer your question about why you would want a configuration language to have functions?