Skip to content

Workspaces

Manage workspaces from the command line. Workspaces help organize repositories by cloud provider and environment.

Overview

Workspaces in Controlinfra:

  • Group repositories by cloud provider (AWS, Azure, GCP)
  • Organize infrastructure by environment (production, staging, dev)
  • Enable filtering and management at scale

List Workspaces

View all workspaces:

bash
controlinfra workspaces list

Output:

┌──────────┬─────────────────┬───────┬─────────┬─────────────┐
│ ID       │ Name            │ Cloud │ Default │ Created     │
├──────────┼─────────────────┼───────┼─────────┼─────────────┤
│ a1b2c3d4 │ Production AWS  │ aws   │ Yes     │ 3 days ago  │
│ e5f6g7h8 │ Staging AWS     │ aws   │ No      │ 1 week ago  │
│ i9j0k1l2 │ Production GCP  │ gcp   │ No      │ 2 days ago  │
│ m3n4o5p6 │ Production Azure│ azure │ No      │ 5 days ago  │
└──────────┴─────────────────┴───────┴─────────┴─────────────┘

JSON Output

bash
controlinfra workspaces list --json

Create a Workspace

Create a new workspace for a specific cloud provider:

bash
controlinfra workspaces add <name> --cloud-provider <provider>

Options

OptionDescriptionDefault
--cloud-provider <provider>Cloud provider: aws, azure, gcpaws

Examples

AWS Workspace

bash
controlinfra workspaces add "Production AWS" --cloud-provider aws

Azure Workspace

bash
controlinfra workspaces add "Production Azure" --cloud-provider azure

GCP Workspace

bash
controlinfra workspaces add "Production GCP" --cloud-provider gcp

With GCP Service Account (from JSON file)

When creating a GCP workspace, you can import credentials from a service account JSON file:

bash
controlinfra workspaces add "Production GCP" \
  --cloud-provider gcp \
  --gcp-json-file /path/to/service-account.json

Output:

✔ Workspace "Production GCP" created successfully

Workspace ID: 695f0a4798be040a1304643d
Add a repository to this workspace with:
  controlinfra repos add owner/repo --workspace 695f0a4798be040a1304643d

Workspace Details

Get detailed information about a workspace:

bash
controlinfra workspaces info <workspace-id>

Output:

┌──────────────────────────────────────────────────────────┐
│ Workspace Details                                         │
├──────────────────────────────────────────────────────────┤
│ Name:         Production AWS                              │
│ Cloud:        aws                                         │
│ Default:      Yes                                         │
│ Created:      3 days ago                                  │
│ Updated:      1 hour ago                                  │
└──────────────────────────────────────────────────────────┘

Note: You can use partial IDs (last 8 characters) for workspace commands.

Set Default Workspace

Set a workspace as the default:

bash
controlinfra workspaces default <workspace-id>

The default workspace is used when creating repositories without specifying a workspace.

Remove a Workspace

Delete a workspace:

bash
controlinfra workspaces remove <workspace-id>

You'll be prompted to confirm. Use --force to skip confirmation:

bash
controlinfra workspaces remove <workspace-id> --force

WARNING

Removing a workspace does not delete the repositories in it. Repositories will become unassigned.

Working with Workspaces

List Repositories in a Workspace

bash
controlinfra repos list --workspace <workspace-id>

Add Repository to a Workspace

bash
controlinfra repos add owner/repo \
  --workspace <workspace-id> \
  --cloud-provider aws \
  --access-key AKIAXXXXXXXX \
  --secret-key wJalrXXXXXXXX

Cloud Provider Matching

When adding a repository, the cloud provider must match the workspace's cloud provider. For example, you cannot add an AWS repository to a GCP workspace.

Workspace Options by Cloud Provider

AWS Workspace Options

bash
controlinfra workspaces add "My AWS Workspace" \
  --cloud-provider aws \
  --region us-east-1 \
  --auth-method credentials
OptionDescriptionDefault
--auth-methodcredentials, instance_profile, assume_rolecredentials
--regionAWS regionus-east-1

Azure Workspace Options

bash
controlinfra workspaces add "My Azure Workspace" \
  --cloud-provider azure \
  --azure-auth-method service_principal \
  --azure-environment public
OptionDescriptionDefault
--azure-auth-methodservice_principal, managed_identityservice_principal
--azure-environmentpublic, usgovernment, german, chinapublic
--subscription-idAzure Subscription ID-

GCP Workspace Options

bash
controlinfra workspaces add "My GCP Workspace" \
  --cloud-provider gcp \
  --gcp-auth-method service_account \
  --gcp-json-file /path/to/key.json
OptionDescriptionDefault
--gcp-auth-methodservice_account, workload_identityservice_account
--gcp-project-idGCP Project ID-
--gcp-client-emailService Account email-
--gcp-private-keyService Account private key-
--gcp-json-filePath to Service Account JSON file-

Best Practices

1. Organize by Environment and Provider

Create separate workspaces for each environment and cloud provider:

bash
controlinfra workspaces add "Production AWS" --cloud-provider aws
controlinfra workspaces add "Staging AWS" --cloud-provider aws
controlinfra workspaces add "Production GCP" --cloud-provider gcp
controlinfra workspaces add "Production Azure" --cloud-provider azure

2. Use Descriptive Names

Include the environment and cloud provider in the name for easy identification:

  • Production AWS - US East
  • Staging GCP - Europe
  • Development Azure - West US

3. Set a Default Workspace

Set your most-used workspace as default to streamline repository creation:

bash
controlinfra workspaces default <workspace-id>

Next Steps

AI-powered infrastructure drift detection