
Visual Studio Code (VSCode) is a free, open-source code editor from Microsoft, and it handles plenty of languages used in infrastructure as code, including Terraform and OpenTofu. Part of what makes it useful is the plugin ecosystem. Most IaC developers already know the Terraform plugin, but this post covers Scalr's new VSCode extension for working with Terraform and OpenTofu.
With it, you can update your Terraform code, browse workspaces, and check run results without leaving VSCode for the Scalr UI.
We recently released the beta version of the Scalr VSCode extension to cut down on the context switching that developers using Terraform and Scalr deal with. The main features include:
Pulling run results into VSCode means less time spent logging into the Scalr UI. We try to meet developers where they already work, so now you can edit your Terraform code, test it, and read the results you need in the same editor.
If you still need to log into the UI for more information, each workspace has an icon next to it, which will log you directly into that workspace in Scalr.
To use the extension, you must first download it from the VSCode marketplace.
Once the extension is installed, you can authenticate to Scalr by providing your account name and a token. IMPORTANT: Only the account name is needed. You do not need to add ".scalr.io" to the name.
Once authenticated, the extension will automatically import all workspaces that you have access to with the ability to filter them by environment and workspace ID:

Workspaces download in VSCode
The icons to the left of the workspace name show the current status of the workspace, whether the last run was successful or not, or if a run has been executed at all.
After clicking on a workspace, you can also see all of the run history for the workspace as well as the run outputs:

Plan history in VSCode
Actions, such as terraform plan, terraform apply, terraform refresh, and terraform destroy can be taken directly from VSCode by clicking on the "play" button next to the workspace name:

Actions available in VSCode
Once an action has started, the Terraform log output will stream directly back into the VSCode extension.
We want to continue to work with the community to build a VSCode extension that will improve the developer experience not only for Scalr, but also Terraform and OpenTofu. We encourage all users to report issues and raise feature requests directly in our GitHub repository.
If you haven't used it yet, the HashiCorp Terraform extension is worth having alongside Scalr's. It speeds up writing configuration files by auto-completing providers, resource names, and data sources. Syntax validation runs in the editor, so you catch errors in your Terraform files sooner, and the syntax highlighting picks out modules, providers, and conditional expressions. Its module explorer lists the Terraform modules used in the configuration you're working on, which makes the code easier to navigate. For local development, the extension also runs terraform init, terraform plan, and terraform apply without leaving the editor.
