mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-02-16 16:00:37 -05:00
* Initial renaming, rewriting and cleaning up wave for the CLI docs. Signed-off-by: Jakub Martin <kubam@spacelift.io> * More renaming. Signed-off-by: Jakub Martin <kubam@spacelift.io> * More renaming. Signed-off-by: Jakub Martin <kubam@spacelift.io> * More renaming. Signed-off-by: Jakub Martin <kubam@spacelift.io> * Remove tutorial references. Signed-off-by: Jakub Martin <kubam@spacelift.io> * Post-review fixes. Signed-off-by: Jakub Martin <kubam@spacelift.io> --------- Signed-off-by: Jakub Martin <kubam@spacelift.io>
44 lines
1.8 KiB
Plaintext
44 lines
1.8 KiB
Plaintext
---
|
|
page_title: 'Command: workspace delete'
|
|
description: The opentf workspace delete command is used to delete a workspace.
|
|
---
|
|
|
|
# Command: workspace delete
|
|
|
|
The `opentf workspace delete` command is used to delete an existing workspace.
|
|
|
|
## Usage
|
|
|
|
Usage: `opentf workspace delete [OPTIONS] NAME [DIR]`
|
|
|
|
This command will delete the specified workspace.
|
|
|
|
To delete a workspace, it must already exist, it must not be tracking resources,
|
|
and it must not be your current workspace. If the workspace is tracking resources,
|
|
OpenTF will not allow you to delete it unless the `-force` flag is specified.
|
|
|
|
Additionally, different [backends](/opentf/language/settings/backends/configuration#backend-types) may implement other
|
|
restrictions on whether a workspace is considered safe to delete without the `-force` flag, such as whether the workspace is locked.
|
|
|
|
If you delete a workspace which is tracking resources (via `-force`), then resources
|
|
may become "dangling". These are resources that physically exist but that
|
|
OpenTF can no longer manage. This is sometimes preferred: you may want
|
|
OpenTF to stop managing resources, so they can be managed some other way.
|
|
Most of the time, however, this is not intended and so OpenTF protects you
|
|
from getting into this situation.
|
|
|
|
The command-line flags are all optional. The only supported flags are:
|
|
|
|
* `-force` - Delete the workspace even if it is tracking resources. After deletion, OpenTF can no longer track or manage the workspace's infrastructure. Defaults to false.
|
|
* `-lock=false` - Don't hold a state lock during the operation. This is
|
|
dangerous if others might concurrently run commands against the same
|
|
workspace.
|
|
* `-lock-timeout=DURATION` - Duration to retry a state lock. Default 0s.
|
|
|
|
## Example
|
|
|
|
```
|
|
$ opentf workspace delete example
|
|
Deleted workspace "example".
|
|
```
|