As Hashicorp Partners, here at nubeGO we’re eagerly anticipating the imminent release of Terraform 0.12. The new Terraform release will contain the first major upgrade to HCL, Hashicorp’s proprietary configuration language, since it was launched 4 years ago; if you’re worried about what impact this might have on your existing Terraform scripts, or just interested to find out what all of the fuss is about, here’s a quick summary of what to expect from Terraform 0.12 when it is released this Autumn.
1-2-1 JSON to HCL Mapping
For many years, Hashicorp have allowed you to use JSON as configuration in Terraform in addition to HCL but, as the mapping between the two notations wasn’t direct, JSON usage with Terraform was a little tricky in places. Terraform 0.12 addresses some of these shortcomings with a clear 1-2-1 mapping between HCL and JSON which means you can use whichever one you prefer…or indeed, both. From this version onwards, there should be feature parity between the two languages.
JSON Error Handling
When your JSON is validated by Terraform, expect to see stricter, but more helpful error messages.
JSON Comments
Use of comments inside HCL for Terraform is a great way of explaining your intention to others. While JSON doesn’t really support commenting, Terraform have now implemented a means for you to add comments to your configuration.
As well as a more reliable JSON syntax, Terraform 0.12 promises lots more improvements to HCL:-
First-class expressions – no more need for "${var.myvariable}"
For-statements over lists or maps
Dynamic blocks
Generalised * operator
Improvements to conditional operators
Template Syntax
Rich types in module inputs and outputs
If your own Terraform configuration sticks closely to the example code in the Terraform documentation then it’s unlikely you’ll have any changes to make when you upgrade and Hashicorp don’t expect the majority of customers to be impacted. However, to make things easier, it's expected that Terraform 0.12 is going to be released with a migration tool that will help you to upgrade your existing scripts. Find out more about upgrading to Terraform 0.12 in the Hashicorp upgrade guide. If you use JSON with your Terraform code, you may find that the JSON parser is more strict than before – if in doubt, run a terraform validate or terraform plan and correct any error messages.
Contact nubeGO ([email protected]) to find out more about Terraform training, DevOps engineers and our Cloud Readiness Assessment.
Comments