Training

Containers

145 Friar Street. Reading RG1 1EX. United Kingdom  |  Tel: +44 20 3901 8501 

Calle Hermosilla, 48, 1º Derecha. Madrid, Madrid 28001. Spain  |  Tel: +34 932 20 48 46

© 2020 by nubeGO Ltd. All rights reserved

Company Number: 09115069

What to Expect in Hashicorp Terraform 0.12

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.

Adding comments to JSON in Terraform

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 (info@nubego.io) to find out more about Terraform training, DevOps engineers and our Cloud Readiness Assessment.


#Terraform #IaC #Hashicorp #Partners

221 views