Learning YAML and JSON

I am completely new to Terraform. That being said, I am beginning my education with how to use Terraform and I have seen lots of references to using YAML. I have also seen lots of material on using JSON. I don’t know either of these and am wondering if I need to learn them both, or is learning one more advantageous than the other?



Hi, I personally learnt and was tortured by YAML while writing Ansible playbooks. After the initial pain, I started to get really fast - just using notepad and keeping an eye on what YAML syntax I had previously used. Most of my issues then were not YAML, but Ansible telling me I had made an error with a module. I’m going to apply the same with Terraform - learn as I go (test, test,test) - not so much learn everything YAML first - although I can understand if you have time - that would be a good idea.

For me personally - I steer clear of JSON if I have a choice

you can use jsonlint website (https://jsonlint.com/) to make the proper json for you to avoid mistakes. its a good validator for your scripts.

Thank you, I appreciate your feedback.

Thank you - this will be very helpful.

Hi @timstspry,

I’m not sure if I understood correctly what you were asking, but I want to note that the two valid syntaxes for Terraform configuration itself are Terraform’s own native language syntax (neither JSON nor YAML) or a JSON variant that’s primarily intended for generating configuration programmatically.

The usual way to write Terraform configuration is in Terraform’s own language, so if you’re learning with the intent of writing Terraform configuration yourself (rather than writing software to generate Terraform configuration) then learning Terraform’s own syntax is the path I would suggest.

Terraform does not support YAML as a syntax for its own language, although some of the remote systems that Terraform can interact with do use YAML as part of their configuration, so it still may be useful to know if you will be working with such a system.


Thanks for the reply and the information!