Skip to main content

atmos terraform workspace delete

Use this command to delete a Terraform workspace for an Atmos component in a stack.

atmos terraform workspace delete --help

Usage

Execute the terraform workspace delete command like this:

atmos terraform workspace delete <component> -s <stack> [workspace-name] [options]

This command deletes a Terraform workspace. The workspace must be empty (contain no resources) before it can be deleted. You cannot delete the currently selected workspace.

caution

A workspace must be empty before it can be deleted. Use terraform destroy to remove all resources first.

tip

Run atmos terraform workspace delete --help to see all the available options

Examples

# Delete a workspace (auto-calculated from stack context)
atmos terraform workspace delete vpc -s dev

# Delete a specific workspace by name
atmos terraform workspace delete vpc -s dev my-workspace

# Force delete a non-empty workspace
atmos terraform workspace delete vpc -s dev my-workspace -force

Arguments

component (required)

Atmos terraform component.

workspace-name (optional)

The name of the workspace to delete. If not provided, Atmos calculates the workspace name from the stack context.

Flags

--stack (alias -s) (required)

Atmos stack.

--dry-run (optional)

Show what would be executed without actually running the command.

atmos terraform workspace delete vpc -s dev --dry-run
--skip-init (optional)

Skip running terraform init before executing the command.

atmos terraform workspace delete vpc -s dev --skip-init

Native Terraform Flags

The atmos terraform workspace delete command supports native terraform workspace delete flags. Pass them directly or use -- to separate Atmos flags from Terraform flags.

-force

Force deletion even if the workspace has resources. Use with caution.

atmos terraform workspace delete vpc -s dev -force my-workspace
-lock=true

Lock the state file when locking is supported. Defaults to true.

atmos terraform workspace delete vpc -s dev -lock=false my-workspace
-lock-timeout=DURATION

Duration to retry a state lock. Defaults to 0s.

atmos terraform workspace delete vpc -s dev -lock-timeout=30s my-workspace

See Also