Robert,
We support JSON for all configuration formats in Terraform, so you can
use that. This isn't a second class citizen, it is fully supported,
has many unit tests, and is purposely built-in to support machine
interaction with Terraform (which we're already building upon). I
suppose I should add this to a FAQ or something, but let me go through
why we chose to create our own format versus using another.
First, a sentence or two on a brief history of my interaction with
configuration formats. I first started Vagrant, which uses a Ruby DSL
for configuration. Throughout the years, this has worked, but a good
number of people have always asked for a standard data structure
format (JSON, YAML, etc.). Despite the fact that Ruby can load any of
these formats, people wanted an officially supported one. Next, I
started Packer, which used JSON. A good number of people have now
asked for something with logic, comments, better human-readability.
The thing is: you can't really win, and its not a bad thing, it just
must be accepted that you can't please everyone here.
So in Terraform, we set out to bring the best of two paradigms: human
friendly and machine interoperable. I firmly believe this format
cannot be a single format, so we supported both our custom HCL and
JSON.
INI is a great format. We use it for a lot of smaller projects (prior
to HCL, now we just use that everywhere). My main disagreement with
INI is that nested structures is quite ugly, and anything other than
string to string mappings is custom and is also ugly. I'd have to
write a parser anyways, basically. The example you even used "gcfg" is
based off of gitconfig, which is a strictly string-to-string small
hierarchy config. They use periods for hierarchy "core.foo". There is
a lot of hierarchy in Terraform files, so it'd be tricky. TFVars is
easier, but HCL and gcfg are identical in that case (except you need
quotes)...
YAML is just a horrid format (obviously my opinion). I've never in my
life used a format and been so sad. This strong opinion is why you'll
never see any HashiCorp support YAML in any official way except
perhaps as interoperability with another project/tool/system. I used
Salt for a good long while, Rails before that, Puppet has some YAML,
etc. What I'm trying to say is that I've given YAML a good fair
chance. There are a few problems with YAML I just despise:
1.) It is very easy to not know what data structure something is
making. I found myself constantly asking "is this a map? is this a
list of maps? is this a map with one list?" I consider myself a
not-stupid individual but getting trapped into these confusions
routinely is a bad sign.
2.) Simple primitive-to-primitive YAML is simple, but then you get
to references (&foo) and inheritence and all this madness using a
syntax that isn't very straightforward. Did that "*foo" just save that
and then not use it? Does "&foo" inherit multiple times? The
complexity is very much real: the specification for YAML is 86 pages
(printed). That is a bit shocking for a data structure language.
I really love JSON though. JSON is simple, the specification is
simple, the types are simple. The downside of JSON is a lack of
comments, and a noisy syntax: you get a lot of quotes, brackets,
commas. The noisiness is very much like Lisp and parentheses (have you
ever counted how many brackets and commas are in a basic JSON
structure?). The result is something where a good % of the characters
in a JSON file aren't human-friendly and the lack of comments just
adds to the noise. Therefore, I see JSON as a fantastic machine
interoperation language, but a sub-par (but not terrible relative to
others) human language.
Perhaps a solution is to extend the syntax document even further.
We've done our best to be very explicit about syntax:
http://www.terraform.io/docs/configuration/resources.html (see
"Syntax")
I hope this helps.
Best,
Mitchell
> --
> You received this message because you are subscribed to the Google Groups
> "Terraform" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
terraform-too...@googlegroups.com.
> To post to this group, send email to
terrafo...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/terraform-tool/36cdb574-2749-4242-8ee3-f30295365c69%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.