Files
opentf/website/docs/cli/commands/workspace/delete.html.md
Martin Atkins 42e0985839 command: use -lock=false consistently in -help output
Previously the docs for this were rather confusing because they showed an
option to turn _on_ state locking, even though it's on by default.

Instead, we'll now show -lock=false in all cases and document it as
_disabling_ the default locking.

While working on this I also noticed that the equivalent docs on the
website were differently inconsistent. I've not made them fully consistent
here but at least moreso than they were before.
2021-05-12 09:27:37 -07:00

1.5 KiB

layout, page_title, sidebar_current, description
layout page_title sidebar_current description
docs Command: workspace delete docs-commands-workspace-sub-delete The terraform workspace delete command is used to delete a workspace.

Command: workspace delete

The terraform workspace delete command is used to delete an existing workspace.

Usage

Usage: terraform workspace delete [OPTIONS] NAME [DIR]

This command will delete the specified workspace.

To delete an workspace, it must already exist, it must have an empty state, and it must not be your current workspace. If the workspace state is not empty, Terraform will not allow you to delete it unless the -force flag is specified.

If you delete a workspace with a non-empty state (via -force), then resources may become "dangling". These are resources that physically exist but that Terraform can no longer manage. This is sometimes preferred: you want Terraform to stop managing resources so they can be managed some other way. Most of the time, however, this is not intended and so Terraform protects you from getting into this situation.

The command-line flags are all optional. The only supported flag is:

  • -force - Delete the workspace even if its state is not empty. 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

$ terraform workspace delete example
Deleted workspace "example".