Terraform extension for VS Code adds Terraform Cloud view
A new view in the HashiCorp Terraform extension for Visual Studio Code shows your Terraform Cloud workspaces and runs, reducing context-switching.
HashiCorp maintains a Terraform extension for Visual Studio Code in order to ensure that practitioners have a first-class editor experience. Our extension has the unique opportunity to accompany you on every step of your journey, from learning the syntax and writing your first lines of HashiCorp Configuration Language (HCL), to provisioning infrastructure as part of larger teams at companies serving millions of users. This post covers a recent integration with Terraform cloud as well as other enhancements added to the Terraform extension for VS Code that some users may not be aware of.
» New: Integration with Terraform Cloud
Earlier this month, we launched a native integration with Terraform Cloud in our VS Code extension to better support professional individuals and teams who rely on Terraform Cloud for standardizing and managing their infrastructure automation and lifecycle.
The core capabilities of the new Terraform Cloud integration focus on providing a read-only view of workspaces and runs in order to reduce the amount of window- and context-switching you need to do. Instead of opening up the Terraform Cloud web interface in your browser to look up why a run failed and then switching back to VS Code to look for the configuration that caused the error, you can now view the apply log side-by-side with your code, allowing you to get back to debugging faster.
To see the full list of features as we continue to add to them over the coming months, check out the extension overview on the Visual Studio Marketplace. And read on to learn more about enhancements you may not know about.
» Analyze module and provider usage
For example, installing HashiCorp's Terraform extension for VS Code also gives you access to our Module and Provider Explorer, which can be used regardless of whether or not you have Terraform Cloud. You can access this functionality by clicking on the HashiCorp Terraform icon in the activity bar:
The Module and Provider Explorers are found under the HashiCorp Terraform icon in the activity bar.
The Module Explorer lists Terraform modules used in the current open folder (root module) in the Explorer Pane, or you can drag it to the Secondary Side Bar pane to keep it in view. Each item shows an icon indicating where the module comes from (local filesystem, Git repository, or Terraform Registry). If the module comes from the Terraform Registry, a link to open the documentation in a browser is provided.
The module panel lists all of the local and remote modules used in your configuration, with Terraform Registry integration for public modules.
The Provider Explorer lists all Terraform providers used in the current open document in the Explorer pane, or you can drag it to the Secondary Side Bar pane for an expanded view.
The providers panel shows the source, version constraint, and installed version of in-use providers, with a direct link to docs on the Terraform Registry.
» Improved language server performance
For some time, we have been tracking reports of poor performance in the Terraform language server, which powers the Terraform extension for VS Code and can also be used to provide IDE features in LSP-compatible editors like Sublime Text, Neovim, and others.
When you open up your editor, the Terraform language server does a lot of work in the background to understand the code you're working on. It has an indexing process that finds all the Terraform files and modules in your current working directory, parses them, and builds an understanding of all the interdependencies and references. It holds this information inside an in-memory database, which is updated as you change your files. If you open a directory with many hundreds of folders and files, this may consume more CPU and memory than intended.
v0.31.5 of the Terraform language server and v2.27.2 of the Terraform VS Code extension (both released in September 2023) include fixes that many users have reported dramatically improve performance. If you've previously tried the extension or the language server and encountered problems with performance but have not yet tried these updates, we encourage you to check them out and let us know if you see a difference.
We know these fixes have not yet addressed all of the performance problems that users encounter, and we continue to investigate and trial possible solutions. If you continue to experience poor performance, please don't hesitate to file an issue on GitHub. The more log output and reproducible configuration you provide, the better we are able to diagnose and address the root cause.
» What's next for the Terraform extension for VS Code
In the coming months, we plan to continue to add features to the Terraform Cloud integration, improve the enhanced validation feature announced at HashiConf last month, complete the Terraform language server's understanding of all Terraform language features (you can track our progress here and here), and implement additional performance enhancements.
Another goal we hope to achieve next year is to move toward a model of Day 0 support for new language features as they come out: as functionality gets added to Terraform, we want our VS Code extension (and other editors powered by the Terraform language server) to provide a best-in-class experience when using those new features.
Whether you’re new to Terraform or an advanced practitioner, we’d love to hear how we can improve the experience of authoring Terraform configuration inside of our VS Code extension or other editors. Please file any bugs you encounter, let us know about your feature requests, and share your questions, thoughts, and experiences in the Terraform Editor Integrations discussion forum.
Sign up for the latest HashiCorp news
More blog posts like this one
New Terraform integrations with Crowdstrike, Datadog, JFrog, Red Hat, and more
12 new Terraform integrations from 9 partners provide more options to automate and secure cloud infrastructure management.
Terraform delivers launch-day support for Amazon S3 Tables, EKS Hybrid Nodes, and more at re:Invent
The Terraform provider for AWS now enables users to manage a variety of new services just announced at re:Invent.
HashiCorp at re:Invent 2024: Infrastructure Lifecycle Management with AWS
A recap of HashiCorp infrastructure news and developments on AWS from the past year, from a new provider launch to simplifying infrastructure provisioning and more.