A VS Code extension to discover Terraform root modules in your project and manage their
terraform workspace state environments — without leaving the editor.
Features
- Root-module discovery — scans the open folder for directories containing
.tffiles and treats each as a switchable root module. - Status bar indicator — shows
<module>: <workspace>for the active root module. Click it to switch workspaces via a quick pick. - Tree view sidebar — a "Terraform Workspaces" activity-bar view listing every root module with its workspaces nested underneath. The active module and current workspace are highlighted.
- Workspace operations — select, create, and delete workspaces with inline actions. Deleting a workspace with non-empty state prompts before force-deleting.
Requirements
- The
terraformCLI on yourPATH(or setterraformWorkspaceManager.terraformPath). - Each root module should be initialized (
terraform init) soterraform workspacecommands succeed.
Settings
| Setting | Default | Description |
|---|---|---|
terraformWorkspaceManager.terraformPath |
terraform |
Path to the terraform executable. |
terraformWorkspaceManager.excludeGlobs |
["**/.terraform/**", "**/node_modules/**", "**/.git/**"] |
Globs excluded during root-module discovery. |
Commands
Terraform: Refresh Root ModulesTerraform: Select Active Root ModuleTerraform: Switch WorkspaceTerraform: New WorkspaceTerraform: Delete Workspace
Developing
npm install
npm run compile # or: npm run watch
Press F5 in VS Code to launch the Extension Development Host.
How it works
The extension shells out to terraform workspace {list,select,new,delete} in the active
root module's directory. The active module is persisted per-workspace in workspaceState,
so your selection survives reloads.