Skip to content

Vscode

← Back to all decks

16 cards — 🟢 3 easy | 🟡 4 medium | 🔴 3 hard

🟢 Easy (3)

1. What VS Code extension provides Terraform syntax highlighting, autocomplete, and format-on-save?

Show answer The HashiCorp Terraform extension. It also provides go-to-definition for module references.

Remember: "VS Code = Visual Studio Code." Built on Electron. Extensions make it powerful for any language.

Fun fact: VS Code is the most popular IDE/editor, used by ~70% of developers (Stack Overflow survey).

Gotcha: The HashiCorp Terraform extension requires terraform CLI to be installed and in PATH for validation features to work.

Example: Enable format-on-save: `"editor.formatOnSave": true` with `"[terraform]": {"editor.defaultFormatter": "hashicorp.terraform"}`.

2. How do you split the integrated terminal in VS Code, and why is this useful for DevOps work?

Show answer Use Ctrl+Shift+5 to split terminals. This lets you run a watch command (e.g., kubectl logs -f) in one pane while editing in another, keeping monitoring and development side by side.

Example: Ctrl+Shift+` opens a new terminal. Use terminal profiles to color-code by environment (green=dev, red=prod).

3. What VS Code setting trims trailing whitespace automatically, and in which file is it configured?

Show answer files.trimTrailingWhitespace: true, configured in settings.json (user settings). This helps maintain clean files across all DevOps file types."

Remember: "VS Code Remote = develop anywhere." Remote-SSH edits files on a server, Dev Containers runs in Docker, Codespaces runs in the cloud.

Gotcha: Extensions install on the remote side — your local machine just runs the UI.

Gotcha: Trimming whitespace can cause unwanted diffs in files with intentional trailing spaces (like Markdown line breaks with two spaces).

🟡 Medium (4)

1. What does the Remote-SSH extension allow you to do, and how does it work?

Show answer Remote-SSH lets you connect to remote servers and edit files as if they were local. You connect via Ctrl+Shift+P, "Remote-SSH: Connect to Host," and enter user@hostname. VS Code then opens folders, runs terminal commands, and enables debugging — all on the remote machine using your ~/.ssh/config.

Under the hood: VS Code installs a server component (~/.vscode-server) on the remote host. Extensions run server-side for performance.

2. What problem do Dev Containers solve, and where is the configuration defined?

Show answer Dev Containers guarantee every contributor has identical tools, versions, and extensions by defining the development environment as code. Configuration lives in .devcontainer/devcontainer.json and can specify a base image, features (Docker, kubectl, Terraform), extensions, and post-create commands.

Analogy: Dev Containers are like "infrastructure as code" for your development environment — every contributor gets the exact same tools.

3. How do you automate common commands like linting and testing in VS Code?

Show answer By defining tasks in .vscode/tasks.json. Each task specifies a label, type (shell), command, and group. Run tasks via Ctrl+Shift+P, "Tasks: Run Task." You can set a default test task so it runs with a keyboard shortcut.

Example: `{"label": "test", "type": "shell", "command": "make test", "group": {"kind": "test", "isDefault": true}}` — Ctrl+Shift+T runs it.

4. How does VS Code validate Kubernetes manifests and GitHub Actions workflows against their schemas?

Show answer The Red Hat YAML extension validates files against JSON schemas. Configure it in settings.json with "yaml.schemas" mapping schema URLs to file globs — e.g., "kubernetes" for k8s/**/*.yaml and the GitHub workflow JSON schema for .github/workflows/*.yml.

🔴 Hard (3)

1. What is a multi-root workspace, and when would a DevOps engineer use one?

Show answer A multi-root workspace lets you open multiple separate directories (app, infrastructure, k8s-config repos) in a single VS Code window, defined in a .code-workspace file. DevOps engineers use it when working across application code, Terraform modules, and Kubernetes manifests simultaneously, avoiding constant window switching.

Example: Create with File > Save Workspace As. The .code-workspace file is JSON listing folder paths and shared settings.

2. How do you configure VS Code to debug a FastAPI application with breakpoints?

Show answer Create a .vscode/launch.json configuration with type "debugpy", request "launch", module "uvicorn", and args pointing to the app module (e.g., "app.api.main:app", "--reload", "--port", "8000"). Set breakpoints by clicking the gutter, then press F5 to start debugging with full variable inspection.

Gotcha: If breakpoints are grayed out, ensure `"justMyCode": false` is set in launch.json to debug into library code.

3. How do you create environment-specific terminal profiles in VS Code, and why is this useful?

Show answer Define profiles in settings.json under "terminal.integrated.profiles.linux" with a path, args that set environment variables (e.g., KUBECONFIG for staging vs production), and visual cues like custom icons and colors (red for production). This prevents accidentally running commands against the wrong cluster.

War story: An engineer ran kubectl delete against production because their terminal was pointed at the wrong cluster. Color-coded profiles prevent this.