On Wednesday, June 10th HashiCorp announced version 2.0 of the Terraform Visual Studio Code Extension.
The extension itself is not new (which is a given, seeing that this is v2.0 versus v1.0), but it’s an important step forward. Why? Because this is the first release of the extension since HashiCorp took over support and ownership of the extension. Originally it was developed and supported by Mikael Olenfalk.
For this inaugural release, HashiCorp has included in the extension, support, and usage of its Terraform Langauge Server, and also Terraform 0.12 syntax.
Now, of course, this is a journey, and it’s only just beginning. In HashiCorp’s own words:
In our initial release we are focusing on implementing code completion functionality for data source, resource, and attribute information. Over time though, we plan to add expression completion support, module completion support, and many other features.
Extension In Action
The first thing to call out is that, in order to use the new Terraform Language Server as part of this extension, you need to run terraform init in your working directory first. This is different to other Terraform extensions I’ve used (namely the Advanced Terraform Snippets Generator by Richard Sentino).
To use the new extension, in your .TF file, you need to press Ctrl + Space to get the IntelliSense to appear; whereas with the Advanced Terraform Snippet Generator, you do not (you just have to type “tf-” and the IntelliSense just appears). Not a game-changer or deal-breaker, just a point of confusion I had when first attempting to use it.
Another comparison I’m going to make, is the on the resource properties. With the Snippet Generator extension, when you select a resource type, it will pre-populate the code-block with some starting resource properties.
In the official Terraform Extension, it won’t pre-populate any default/starter resource properties. However, one thing that I really like about it, is how (again, after pressing Ctrl + Space), it will list the available properties, and more importantly, show if the property is optional or required, and the type of input (ie. “string”) the property is expecting.
A few things that I would like to see in a future version/enhancement to this extension, would be to include suggestions, or allowed values for the property values themselves. That would ensure that we’re only using values that are valid for the deployment (where applicable).
The other thing I’d like to see, is for the official extension to take a page out of the Advanced Terraform Snippets Generator extension, and pre-populate some standard/default properties to give everyone a starting point.
Other than that, I’m loving this new/refreshed extension, and look forward to the future enhancements that HashiCorp will provide.