github.com/hugorut/terraform@v1.1.3/website/docs/cli/commands/workspace/delete.mdx (about)

     1  ---
     2  page_title: 'Command: workspace delete'
     3  description: The terraform workspace delete command is used to delete a workspace.
     4  ---
     5  
     6  # Command: workspace delete
     7  
     8  The `terraform workspace delete` command is used to delete an existing workspace.
     9  
    10  ## Usage
    11  
    12  Usage: `terraform workspace delete [OPTIONS] NAME [DIR]`
    13  
    14  This command will delete the specified workspace.
    15  
    16  To delete an workspace, it must already exist, it must have an empty state,
    17  and it must not be your current workspace. If the workspace state is not empty,
    18  Terraform will not allow you to delete it unless the `-force` flag is specified.
    19  
    20  If you delete a workspace with a non-empty state (via `-force`), then resources
    21  may become "dangling". These are resources that physically exist but that
    22  Terraform can no longer manage. This is sometimes preferred: you want
    23  Terraform to stop managing resources so they can be managed some other way.
    24  Most of the time, however, this is not intended and so Terraform protects you
    25  from getting into this situation.
    26  
    27  The command-line flags are all optional. The only supported flag is:
    28  
    29  * `-force` - Delete the workspace even if its state is not empty. Defaults to false.
    30  * `-lock=false` - Don't hold a state lock during the operation. This is
    31    dangerous if others might concurrently run commands against the same
    32    workspace.
    33  * `-lock-timeout=DURATION` - Duration to retry a state lock. Default 0s.
    34  
    35  ## Example
    36  
    37  ```
    38  $ terraform workspace delete example
    39  Deleted workspace "example".
    40  ```