github.com/pulumi/terraform@v1.4.0/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 a workspace, it must already exist, it must not be tracking resources,
    17  and it must not be your current workspace. If the workspace is tracking resources,
    18  Terraform will not allow you to delete it unless the `-force` flag is specified.
    19  
    20  Additionally, different [backends](/language/settings/backends/configuration#backend-types) may implement other
    21  restrictions on whether a workspace is considered safe to delete without the `-force` flag, such as whether the workspace is locked.
    22  
    23  If you delete a workspace which is tracking resources (via `-force`), then resources
    24  may become "dangling". These are resources that physically exist but that
    25  Terraform can no longer manage. This is sometimes preferred: you may want
    26  Terraform to stop managing resources, so they can be managed some other way.
    27  Most of the time, however, this is not intended and so Terraform protects you
    28  from getting into this situation.
    29  
    30  The command-line flags are all optional. The only supported flags are:
    31  
    32  * `-force` - Delete the workspace even if it is tracking resources. After deletion, Terraform can no longer track or manage the workspace's infrastructure. Defaults to false.
    33  * `-lock=false` - Don't hold a state lock during the operation. This is
    34    dangerous if others might concurrently run commands against the same
    35    workspace.
    36  * `-lock-timeout=DURATION` - Duration to retry a state lock. Default 0s.
    37  
    38  ## Example
    39  
    40  ```
    41  $ terraform workspace delete example
    42  Deleted workspace "example".
    43  ```