Project: VS Code

Create a project with VS Code in this lesson.

Building infrastructure without leaving VS Code

As you have read, VS Code isn’t just for writing and editing code, it’s a complete IDE full of other tools that make a developer’s life easier. To demonstrate that, in this chapter project, you’re going to build an entire server infrastructure testing environment without ever leaving VS Code.

Using built-in VS Code tooling and a few extensions, you will build an entire set of tools to write code, commit to source control, build VMs, configure infrastructure, and deploy an application using a single interface.

Project overview

In this chapter project, you’re going to learn how to use VS Code by building a project. You’ve been tasked with figuring out how to build an Azure VM with Terraform as a small proof of concept (POC) project. You have VS Code and have heard of its capability as a full IDE and want to put it to the test.

You’re going to:

  • Create a VS Code workspace to share with your team.

  • Install the Terraform extension.

  • Modify the Terraform configuration file to fit your naming convention and Azure subscription.

  • Create a snippet for a common task you’ve found yourself typing over and over.

  • Commit the Terraform configuration file to a Git repo.

  • Use the integrated terminal to invoke Terraform commands.

Setting up a workspace

Typically, if you’re just opening up VS Code for the first time, you can open up a new editor tab and get down to coding. But, in this fictional scenario, you’re on a team of developers that need to stay in sync as much as possible. Using a workspace, you can ensure everyone uses the same settings across a project. So let’s first create a workspace.

Clone the Git repo

Before you can create a workspace though, you must have at least one folder containing project files. For this project, you’ll be working from a GitHub repo called VSCodeDemo. Since VS Code has native Git integration, you can clone a Git repo with no additional configuration. To do so, open the command palette with Ctrl-Shift-P and type git where you will notice various options as shown below:

Choose Git: Clone, which VS Code will then prompt you for the repo’s URL. Use the URL https://github.com/NoBSDevOps/VSCodeDemo.git, hit Enter, and ...