The init space command creates and configures workspaces (spaces) for organizing multiple ThothCTL projects. Spaces provide isolated contexts with their own credentials, VCS configuration, governance policies, and scan thresholds.
# Interactive creation (prompts for details)
thothctl init space --name "production" --description "Production environment"
# Non-interactive creation (CI/CD pipelines)
thothctl init space --name "production" \
--description "Production environment" \
--vcs-provider github \
--vcs-token ghp_xxxxxxxxxxxx \
--vcs-org myorg \
--credential-password mysecretpassword \
--policy-repo https://github.com/myorg/iac-policies.git
| Option | Type | Description |
|---|---|---|
--name, -n |
Text | Name of the space (required) |
--description, -d |
Text | Human-readable description |
--vcs-provider |
Choice | VCS provider: github, gitlab, azure_repos |
--orchestration-tool |
Choice | Orchestration tool: terragrunt, terramate, none |
--terraform-registry |
Text | Terraform registry URL |
These options enable fully automated space creation without interactive prompts, suitable for CI/CD pipelines and scripted environments:
| Option | Type | Description |
|---|---|---|
--vcs-token |
Text | VCS personal access token (GitHub PAT, GitLab token, Azure DevOps PAT) |
--vcs-org |
Text | VCS organization or namespace |
--credential-password |
Text | Password used to encrypt stored credentials |
--policy-repo |
Text | Git URL or local path for organization-level IaC policies |
Environment variables can substitute for non-interactive CLI flags. They are consumed during init space and take precedence over interactive prompts (but CLI flags take precedence over env vars):
| Variable | Equivalent Flag | Description |
|---|---|---|
THOTH_SPACE_TOKEN |
--vcs-token |
VCS personal access token |
THOTH_SPACE_ORG |
--vcs-org |
VCS organization name |
THOTH_SPACE_PASSWORD |
--credential-password |
Credential encryption password |
THOTH_SPACE_TF_TOKEN |
(used at registry auth time) | Terraform registry authentication token |
Precedence order: CLI flag > environment variable > interactive prompt.
spaces.<name>.projects in spaces.tomlconfigs/scan_policy.toml for scan enforcement thresholdsAfter creation, the space directory layout is:
~/.thothcf/
├── spaces.toml # Single source of truth for all space config
├── active_space # Currently active space name (plain text file)
├── .thothcf.toml # Global project registry (legacy, backward compat)
└── spaces/
└── <space-name>/
├── metadata.toml # Directory identification (name, created_at, config_source)
├── credentials/ # Encrypted VCS/TF/cloud credentials (.enc files)
├── configs/ # Space-level policy overrides
│ └── scan_policy.toml # Scan enforcement + supply chain thresholds
├── vcs/ # Provider-specific config (github.toml, etc.)
├── terraform/ # Registry config (registry.toml)
└── orchestration/ # Tool config (terragrunt.toml, etc.)
spaces.toml — Single source of truth. All space configuration (name, description, VCS, terraform, orchestration, governance, projects) is stored here under [spaces.<name>].metadata.toml — Minimal directory identification file. Contains only name, created_at, and config_source = "spaces.toml". Does NOT contain configuration.configs/scan_policy.toml — Space-level overrides for scan enforcement mode and supply chain thresholds.thothctl init space --name "production" \
--description "Production infrastructure projects" \
--vcs-provider "github"
The wizard will prompt for remaining details (PAT token, organization, registry).
thothctl init space --name "development" \
--description "Development and testing projects" \
--vcs-provider "github" \
--orchestration-tool "terragrunt"
For automated pipelines where no interactive input is available:
# Using CLI flags
thothctl init space --name "ci-production" \
--description "Production space for CI" \
--vcs-provider github \
--vcs-token ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
--vcs-org myorg \
--credential-password "${VAULT_CREDENTIAL_PASSWORD}" \
--policy-repo https://github.com/myorg/iac-policies.git \
--terraform-registry https://app.terraform.io \
--orchestration-tool terragrunt
# Using environment variables
export THOTH_SPACE_TOKEN="ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
export THOTH_SPACE_ORG="myorg"
export THOTH_SPACE_PASSWORD="vault-managed-secret"
export THOTH_SPACE_TF_TOKEN="team-xxxxxxxxxxxx.atlasv1.xxxxxxxxxx"
thothctl init space --name "ci-production" \
--description "Production space for CI" \
--vcs-provider github \
--policy-repo https://github.com/myorg/iac-policies.git
name: Setup ThothCTL Space
on:
workflow_dispatch:
jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install ThothCTL
run: pip install thothctl
- name: Create space (non-interactive)
env:
THOTH_SPACE_TOKEN: $
THOTH_SPACE_ORG: $
THOTH_SPACE_PASSWORD: $
THOTH_SPACE_TF_TOKEN: $
run: |
thothctl init space --name "production" \
--description "Production infrastructure" \
--vcs-provider github \
--policy-repo https://github.com/$/iac-policies.git \
--terraform-registry https://app.terraform.io \
--orchestration-tool terragrunt
thothctl space activate production
thothctl list spaces
init project - Initialize projects within a spacelist spaces - List available spacesspace activate - Set active spacespace deactivate - Clear active spacespace show - Display space configurationspace update - Modify space settingsremove space - Remove spaces