Problem
When running specific versions of Terraform Enterprise, you may be unable to safely delete a workspace. The user interface returns the following error:
latest workspace state is being processed to discover resources. Please try again later
Investigation shows that the resources_processed flag on workspace state versions remains false, even after successful runs and destroys. This state prevents safe deletion of the workspace.
Prerequisites
- Terraform Enterprise versions from v202404-1 through v1.0.3.
Cause
This issue is caused by a known bug in the WorkspaceResourcesWorker component, which is present in the affected versions of Terraform Enterprise.
Solutions
There are two approaches to resolve this issue. The recommended solution is to upgrade Terraform Enterprise, which permanently fixes the bug. If an immediate upgrade is not possible, you can use the Force Delete API as a temporary workaround.
Solution 1: Upgrade Terraform Enterprise (Recommended)
The issue is fully resolved by upgrading to Terraform Enterprise v1.1.0 or later, where the WorkspaceResourcesWorker component has been removed. After the upgrade, resource processing jobs complete as expected, the resources_processed flag updates correctly, and workspaces no longer become stuck in a non-deletable state.
Solution 2: Use the Force Delete API (Workaround)
As a temporary workaround for affected versions, you can use the Force Delete API endpoint to delete workspaces that are stuck in this state. This option bypasses the safety checks that prevent deletion.
Additional Information
- For more details on the permanent fix, refer to the Terraform Enterprise v1.1.1 release notes.
- For instructions on using the workaround, see the Force Delete a Workspace API documentation.