Skip to content

cli: Add organization delete command #21891

@uzair-coder07

Description

@uzair-coder07

Requested by customer on ticket 4943.

Description

Currently, the CLI supports creating organizations via coder organizations create, but there is no corresponding coder organizations delete command. The API endpoint already exists (DELETE /organizations/{organization}) and is available in the UI, but CLI users cannot delete organizations.

Current State

The coder organizations command currently supports these subcommands:

  • show - Show organization details
  • create - Create a new organization
  • members - Manage organization members
  • roles - Manage organization roles
  • settings - Manage organization settings

Proposed Solution

Add a coder organizations delete <organization_name> command that:

  1. Accepts organization name or ID as an argument
  2. Prevents deletion of the default organization (matching API behavior)
  3. Includes a confirmation prompt (with --yes flag to skip)
  4. Provides clear error messages when the organization cannot be deleted due to existing resources (workspaces, templates, members, groups, provisioner keys)

Example Usage

# Delete with confirmation prompt
coder organizations delete my-org

# Delete without confirmation
coder organizations delete my-org --yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions