### Configure Output Formats Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Examples of how to control the output format and verbosity of CLI commands. ```bash # JSON output (default) terrakube organization list --output json # YAML output terrakube organization list --output yaml # Table output terrakube organization list --output table # TSV output (for scripting) terrakube organization list --output tsv # No output (silent mode) terrakube organization create -n myorg --output none # Hide null values in JSON (default: true) terrakube organization list --hide-nulls=false # Verbose mode terrakube organization list --verbose ``` -------------------------------- ### Install Terrakube CLI via Homebrew Source: https://github.com/terrakube-io/terrakube-cli/blob/main/README.md Use this command to install the Terrakube CLI using Homebrew on macOS. ```bash brew install terrakube-io/cli/terrakube ``` -------------------------------- ### Install Terrakube CLI via Chocolatey Source: https://github.com/terrakube-io/terrakube-cli/blob/main/README.md Use this command to install the Terrakube CLI using Chocolatey on Windows. ```powershell choco install terrakube ``` -------------------------------- ### Upgrade Terrakube CLI via Homebrew Source: https://github.com/terrakube-io/terrakube-cli/blob/main/README.md Use this command to upgrade an existing Terrakube CLI installation managed by Homebrew on macOS. ```bash brew upgrade terrakube ``` -------------------------------- ### Upgrade Terrakube CLI via Chocolatey Source: https://github.com/terrakube-io/terrakube-cli/blob/main/README.md Use this command to upgrade an existing Terrakube CLI installation managed by Chocolatey on Windows. ```powershell choco upgrade terrakube ``` -------------------------------- ### Build Terrakube CLI from Source Source: https://github.com/terrakube-io/terrakube-cli/blob/main/README.md Follow these steps to clone the repository, navigate into the directory, and build the Terrakube CLI executable from source. Requires Go 1.25 or later. ```bash git clone https://github.com/terrakube-io/terrakube-cli.git cd terrakube-cli go build -o terrakube . ``` -------------------------------- ### Build and Test Commands Source: https://github.com/terrakube-io/terrakube-cli/blob/main/AGENTS.md Common development tasks managed via mise. ```bash mise run build # go build ./... mise run test # go test -race ./... mise run lint # golangci-lint run ./... mise run vulncheck # govulncheck ./... mise run check # all of the above ``` -------------------------------- ### Create Terrakube Module Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Use to create a module in the private module registry. Requires organization, name, description, provider, source repository, tag prefix, and folder path. ```bash terrakube module create \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --name vpc-module \ --description "VPC module for AWS" \ --provider azurerm \ --source https://github.com/terrakube-io/terraform-sample-repository.git \ --tag-prefix v \ --folder /modules/vpc ``` -------------------------------- ### Manage VCS Connections Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Commands for configuring and managing version control system connections for repository access. ```bash # Create a GitHub OAuth connection terrakube vcs create \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --name "GitHub Production" \ --description "GitHub OAuth connection" \ --vcs-type GITHUB \ --connection-type OAUTH \ --client-id "your-github-client-id" \ --client-secret "your-github-client-secret" \ --endpoint "https://github.com" \ --vcs-api-url "https://api.github.com" # List VCS connections terrakube vcs list -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb # Delete a VCS connection terrakube vcs delete \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --id vcs-connection-id ``` -------------------------------- ### Project Directory Structure Source: https://github.com/terrakube-io/terrakube-cli/blob/main/AGENTS.md Overview of the project layout and core components. ```text main.go # Entry point, calls cmd.Execute() cmd/ # Cobra command definitions root.go # Root command, config init, output rendering .go # Parent command for each resource (organization, workspace, etc.) _.go # Hand-written subcommands: create, list, update, delete template.go # Framework-registered resource (via resource.Register) vcs.go # Framework-registered resource workspace_tag.go # Framework-registered resource internal/ output/ # Output rendering (json, yaml, table, tsv, none) renderer.go # Render(w, data, format) function resource/ # Generic resource framework resource.go # Config[T], Register[T](), field population resolve.go # Parent scope name resolution testutil/ # Test infrastructure server.go # HTTP test server for API mocking assertions.go # Common test assertion helpers fixtures.go # Shared test data ``` -------------------------------- ### Current Project Structure Comparison Source: https://github.com/terrakube-io/terrakube-cli/blob/main/docs/api-coverage-audit.md Visual representation of the redundant file structures between the CLI and Terraform provider clients. ```text terrakube-cli/client/ terraform-provider-terrakube/internal/client/ client/ client.go organization.go - OrganizationEntity workspace.go - WorkspaceEntity module.go - ModuleEntity job.go - (no equivalent) team.go - TeamEntity variable.go - WorkspaceVariableEntity models/ - ... 14 more entities organization.go (all in one file) workspace.go module.go job.go team.go variable.go ``` -------------------------------- ### Manage Workflow Templates Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Commands for creating, listing, retrieving, and deleting workflow templates that define workspace execution steps. ```bash # Create a basic plan/apply template terrakube template create \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --name "Plan and Apply" \ --description "Standard plan and apply workflow" \ --version "1.0.0" \ --content 'flow: - type: "terraformPlan" name: "Plan" - type: "terraformApply" name: "Apply"' # List templates terrakube template list -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb # Get a specific template terrakube template get \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --id template-id-here # Delete a template terrakube template delete \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --id template-id-here ``` -------------------------------- ### Proposed Shared Library Structure Source: https://github.com/terrakube-io/terrakube-cli/blob/main/docs/api-coverage-audit.md Proposed directory layout for the unified terrakube-go client library. ```text github.com/terrakube-io/terrakube-go/ models/ # JSON:API model structs (shared) client/ # HTTP client with CRUD methods (shared) jsonapi/ # JSON:API marshaling (use google/jsonapi) ``` -------------------------------- ### List Workspaces Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt List workspaces within a specific organization, with options to filter by name and format output as a table. ```bash # List all workspaces in an organization terrakube workspace list -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb ``` ```bash # Filter workspaces by name terrakube workspace list \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --filter name==myWorkspace ``` ```bash # Output as table terrakube ws list -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb --output table ``` -------------------------------- ### Manage Workspace Tags Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Commands for associating, listing, and removing tags from workspaces. ```bash # Create a workspace tag association terrakube workspace-tag create \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -w 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --tag-id tag-abc123 # List workspace tags terrakube workspace-tag list \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -w 38b6635a-d38e-46f2-a95e-d00a416de4fd # Delete a workspace tag terrakube workspace-tag delete \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -w 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --id workspace-tag-id ``` -------------------------------- ### Create Workspace Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Create a new workspace within an organization. Supports VCS-connected or CLI-driven workspaces, specifying source repository, branch, IaC version, and execution mode. ```bash # Create a VCS-connected workspace terrakube workspace create \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -n myWorkspace \ --source https://github.com/terrakube-io/terraform-sample-repository.git \ --branch master \ --iac-version 1.5.0 \ --iac-type terraform \ --execution-mode remote \ --folder / ``` ```bash # Create a CLI-driven workspace (for local Terraform runs) terrakube workspace create \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -n cli-workspace \ --cli \ --iac-version 1.6.0 ``` ```bash # Create workspace with description terrakube workspace create \ --organization-id e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --name dev-workspace \ --description "Development environment" \ --source https://github.com/org/repo.git \ --branch develop ``` -------------------------------- ### Set Terrakube CLI Authentication and Defaults Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Configure API URL, token, default organization, and workspace using environment variables. This allows subsequent commands to omit organization and workspace flags. ```bash export TERRAKUBE_API_URL=https://terrakube.example.com export TERRAKUBE_TOKEN=your-api-token export TERRAKUBE_ORGANIZATION_ID=e5ad0642-f9b3-48b3-9bf4-35997febe1fb export TERRAKUBE_WORKSPACE_ID=38b6635a-d38e-46f2-a95e-d00a416de4fd ``` -------------------------------- ### List Terrakube Workspaces Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Execute the 'workspace list' command after setting default organization and workspace variables. This command lists available workspaces within the configured organization. ```bash terrakube workspace list ``` -------------------------------- ### Create Organization Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Create a new organization in Terrakube. Organizations serve as top-level containers. Supports specifying name, description, execution mode, and an icon URL. ```bash # Create a basic organization terrakube organization create -n myorg -d "My organization description" ``` ```bash # Create organization with execution mode and icon terrakube organization create \ --name production-org \ --description "Production infrastructure" \ --executionMode remote \ --icon "https://example.com/icon.png" ``` ```json # Output (JSON format): # { # "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", # "name": "myorg", # "description": "My organization description", # "executionMode": "remote" # } ``` -------------------------------- ### Login to Terrakube Server Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Authenticate to a Terrakube server using a Personal Access Token (PAT). Credentials are saved to `~/.terrakube-cli.yaml` for subsequent commands. Supports direct URL and token input, or using environment variables `TERRAKUBE_API_URL` and `TERRAKUBE_PAT`. ```bash # Login to a local Terrakube server terrakube login -a http://localhost:8080 -t your-pat-token ``` ```bash # Login to a remote Terrakube server terrakube login --api-url https://terrakube.example.com --pat your-pat-token ``` ```bash # Using environment variables export TERRAKUBE_API_URL=https://terrakube.example.com export TERRAKUBE_PAT=your-pat-token terrakube login ``` -------------------------------- ### Create Terrakube Job Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Use to create a job for executing Terraform commands like plan, apply, or destroy on a workspace. Specify organization, workspace, and the command. ```bash # Create an apply job terrakube job create \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -w 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --command apply ``` ```bash # Create a plan job terrakube job create \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -w 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --command plan ``` ```bash # Create a destroy job terrakube job create \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -w 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --command destroy ``` -------------------------------- ### List Terrakube Modules Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Use to list modules within an organization. Filtering by name is supported. ```bash # List all modules terrakube module list -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb ``` ```bash # Filter by name terrakube module list \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --filter name==vpc-module ``` -------------------------------- ### Manage SSH Keys Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Commands for managing SSH keys used to authenticate with private Git repositories. ```bash # Create an SSH key terrakube ssh create \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --name "deploy-key" \ --description "SSH key for private repos" \ --private-key "-----BEGIN RSA PRIVATE KEY-----\n..." \ --ssh-type rsa # List SSH keys terrakube ssh list -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb # Delete an SSH key terrakube ssh delete \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --id ssh-key-id ``` -------------------------------- ### List Terrakube Workspace Variables Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Use to list all variables within a specified workspace. Filtering by key name is supported. ```bash # List all variables terrakube workspace variable list \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -w 38b6635a-d38e-46f2-a95e-d00a416de4fd ``` ```bash # Filter by key name terrakube workspace variable list \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -w 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --filter key==AWS_REGION ``` -------------------------------- ### Manage Workspace Schedules Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Commands for configuring, listing, and deleting scheduled runs for workspaces using cron expressions. ```bash # Create a daily schedule terrakube workspace-schedule create \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -w 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --schedule "0 2 * * *" \ --template-id template-abc123 # List schedules terrakube workspace-schedule list \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -w 38b6635a-d38e-46f2-a95e-d00a416de4fd # Delete a schedule terrakube workspace-schedule delete \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -w 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --id schedule-id ``` -------------------------------- ### List Organizations Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt List all organizations or filter by name. Supports output formatting as table or YAML. ```bash # List all organizations terrakube organization list ``` ```bash # List with filter terrakube organization list --filter name==myorg ``` ```bash # Output as table terrakube organization list --output table ``` ```bash # Output as YAML terrakube organization list --output yaml ``` -------------------------------- ### Update Workspace Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Update an existing workspace's configuration, such as the IaC version, source repository URL, or branch. ```bash # Update Terraform version terrakube workspace update \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --id 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --iac-version 1.6.0 ``` ```bash # Update branch and source terrakube workspace update \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --id 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --branch main \ --source https://github.com/org/new-repo.git ``` -------------------------------- ### Update Organization Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Update an existing organization's properties like description or execution mode using its ID. ```bash # Update organization description terrakube organization update \ --id 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --description "Updated description" ``` ```bash # Update execution mode terrakube organization update \ --id 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --executionMode local ``` -------------------------------- ### Manage Execution Agents Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Commands for managing self-hosted execution agents for running Terraform operations. ```bash # Create an agent terrakube agent create \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --name "on-prem-agent" \ --description "On-premises execution agent" \ --url "https://agent.internal.example.com" # List agents terrakube agent list -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb # Delete an agent terrakube agent delete \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --id agent-id ``` -------------------------------- ### Create Terrakube Team Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Use to create a team within an organization with specific permissions. Permissions include managing workspaces, modules, providers, state, collections, VCS, and templates. ```bash # Create a team with workspace and module permissions terrakube team create \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --name platform-team \ --manage-workspace=true \ --manage-module=true \ --manage-provider=true ``` ```bash # Create a team with all permissions terrakube team create \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --name admin-team \ --manage-workspace=true \ --manage-module=true \ --manage-provider=true \ --manage-state=true \ --manage-collection=true \ --manage-vcs=true \ --manage-template=true ``` -------------------------------- ### List Terrakube Workspace Variables Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Execute the 'workspace variable list' command after setting default organization and workspace variables. This command lists variables associated with the configured workspace. ```bash terrakube workspace variable list ``` -------------------------------- ### Update Terrakube Module Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Use to update module configuration by its ID. Requires organization, module ID, and fields to update like description or source. ```bash terrakube module update \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --id 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --description "Updated VPC module description" \ --source https://github.com/org/new-repo.git ``` -------------------------------- ### Create Terrakube Workspace Variable Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Use to create Terraform or environment variables within a workspace. Specify the organization, workspace, key, value, and category. Sensitive variables and HCL variables are supported. ```bash # Create a Terraform variable terrakube workspace variable create \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -w 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --key tag_name \ --value "Hello World" \ --category TERRAFORM \ --hcl=false \ --sensitive=false ``` ```bash # Create a sensitive environment variable terrakube workspace variable create \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -w 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --key AWS_SECRET_ACCESS_KEY \ --value "secret-value" \ --category ENV \ --sensitive=true \ --hcl=false ``` ```bash # Create an HCL variable terrakube workspace variable create \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -w 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --key instance_tags \ --value '{"Environment" = "dev", "Team" = "platform"}' \ --category TERRAFORM \ --hcl=true \ --sensitive=false ``` -------------------------------- ### List Terrakube Teams Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Use to list teams within an organization. Filtering by name is supported. ```bash # List all teams terrakube team list -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb ``` ```bash # Filter by name terrakube team list \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --filter name==platform-team ``` -------------------------------- ### List Terrakube Jobs Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Use to list jobs within an organization. Filtering by job ID is supported. ```bash # List all jobs terrakube job list -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb ``` ```bash # Filter by job ID terrakube job list \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --filter id==job-abc123 ``` -------------------------------- ### Delete Terrakube Module Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Use to delete a module from the registry by its ID. Requires organization and module ID. ```bash terrakube module delete \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --id 38b6635a-d38e-46f2-a95e-d00a416de4fd ``` -------------------------------- ### Logout from Terrakube Server Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Remove stored credentials for the Terrakube server from the local configuration file. ```bash terrakube logout ``` -------------------------------- ### Delete Workspace Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Delete a workspace from a specific organization using its ID. ```bash terrakube workspace delete \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --id 38b6635a-d38e-46f2-a95e-d00a416de4fd ``` -------------------------------- ### Update Terrakube Workspace Variable Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Use to update an existing variable in a workspace by its ID. Requires organization, workspace, variable ID, and the new value. ```bash terrakube workspace variable update \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -w 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --id 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --value "new value" ``` -------------------------------- ### Update Team Permissions Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Updates the management permissions for a specific team within an organization. ```bash terrakube team update \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --id 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --manage-workspace=true \ --manage-module=true \ --manage-provider=false ``` -------------------------------- ### Delete Team Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Removes a team from an organization. ```bash terrakube team delete \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ --id 38b6635a-d38e-46f2-a95e-d00a416de4fd ``` -------------------------------- ### Delete Terrakube Workspace Variable Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Use to delete a variable from a workspace by its ID. Requires organization, workspace, and variable ID. ```bash terrakube workspace variable delete \ -o e5ad0642-f9b3-48b3-9bf4-35997febe1fb \ -w 38b6635a-d38e-46f2-a95e-d00a416de4fd \ --id 38b6635a-d38e-46f2-a95e-d00a416de4fd ``` -------------------------------- ### Delete Organization Source: https://context7.com/terrakube-io/terrakube-cli/llms.txt Delete an organization from Terrakube using its unique ID. ```bash terrakube organization delete --id 38b6635a-d38e-46f2-a95e-d00a416de4fd ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.