So the only real choices seem to be either a pure data format or else full Turing completeness. There doesn’t seem to be a useful middle ground, unfortunately.
One of the motivating cases is working around the Nix language's shortcomings:
> The Nix package manager: Nix is a declarative package manager using its own language for specifying packages. Nickel is inspired in part by the Nix language, while trying to overcome some of its limitations. It could be used instead of the Nix language.
Guix sidesteps this all by just using a proper language with macros for its configuration.
- What version of Python? They seem to have abandoned semver and are breaking changes across releases.
Granted, a Lua-like language would work well for some of these situations. Lua does have the "what version" problem.
HOME_DIR = '/home/ubuntu'
WORK_DIR = HOME_DIR + '/workspace'
STARTUP_TIME = time.time()
TIMEOUT = 10 * 60
PLUGINS = {
'remoteLogging' : {
'server' : '::1',
'port': 60000
}
It's a bad thing if you're doing big side effects at configuration time (creating directories and such)Btw, there used to be a sandbox built in into stock python (Bastion), but they abandoned it (IRC because of security issues)
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?
... all requiring potentially complex generation of configuration.
I am just skeptical that past some level of complexity, terraform requires a generator.In that sentence, I believe their meaning is that Terraform's language is already capable of generating configuration, and in fact this is a feature which is quite essential to Terraform's use. They acknowledge that all these projects (Nix, Terraform, Bazel, etc) already utilize relatively sophisticated programming languages for configuration. Nickel merely aims to be a better designed language for the purpose.