productivity
Terraform Cloud CLI for Headless Automation
Use the Terraform Cloud CLI for headless automation with headless JSON commands, schema discovery, credentials, and permission controls.
7 functions 7 read 0 write API token auth
Terraform Cloud CLI for Headless Automation
Use KosmoKrator as a non-interactive integration runtime for local automations and wrappers.
Use headless automation when another tool needs a stable local command surface. The Terraform Cloud CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# Terraform Cloud CLI for Headless Automation
kosmokrator integrations:configure terraform --set api_token="$TERRAFORM_API_TOKEN" --enable --read allow --write ask --json
kosmo integrations:call terraform.terraform_list_workspaces '{"organization":"example_organization","pageNumber":1,"pageSize":1}' --json Discovery Before Execution
Agents and scripts can inspect Terraform Cloud docs and schemas before choosing a function.
kosmo integrations:docs terraform --json
kosmo integrations:docs terraform.terraform_list_workspaces --json
kosmo integrations:schema terraform.terraform_list_workspaces --json
kosmo integrations:search "Terraform Cloud" --json
kosmo integrations:list --json Useful Terraform Cloud CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
terraform.terraform_list_workspaces | Read | organization, pageNumber, pageSize | List workspaces in a Terraform Cloud organization. Returns workspace IDs, names, Terraform versions, and locked status. |
terraform.terraform_get_workspace | Read | workspaceId | Get details of a specific Terraform Cloud workspace by its ID. Returns workspace configuration, status, and VCS settings. |
terraform.terraform_list_runs | Read | workspaceId, pageNumber, pageSize | List runs for a Terraform Cloud workspace. Returns run IDs, statuses, trigger reasons, and timestamps. |
terraform.terraform_get_run | Read | runId | Get details of a specific Terraform Cloud run by its ID. Returns run status, plan/apply results, and configuration version info. |
terraform.terraform_list_variables | Read | workspaceId | List variables for a Terraform Cloud workspace. Returns variable names, types (Terraform or environment), and sensitivity flags. |
terraform.terraform_list_organizations | Read | pageNumber, pageSize | List Terraform Cloud organizations the authenticated user has access to. Returns organization names and IDs. |
terraform.terraform_get_current_user | Read | none | Get the currently authenticated Terraform Cloud user. Useful for verifying authentication and retrieving user details. |
Automation Notes
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.