Problem
Terraform Enterprise server may experience disk space issues due to the accumulation of slug files, especially in the directories /opt/terraform/aux/archivist/terraform/slugs/ for Replicated installations and /var/lib/terraform-enterprise/aux/archivist/terraform/slugs for FDO with Docker. These files, which are associated with VCS-driven workspaces, can grow in size, making management difficult when workspaces remain active and cannot be deleted.
Cause
In Terraform Enterprise, slug files—archived configuration versions—are stored in `/opt/terraform/aux/archivist/terraform/slugs` for Replicated installations and `/var/lib/terraform-enterprise/aux/archivist/terraform/slugs` for FDO Docker installations. These files support VCS-driven workspaces by preserving configuration versions for workspace consistency and accurate state management. Over time, as configurations in VCS repositories update, these slug files increase in size and number, consuming substantial disk space. Terraform Enterprise does not automatically delete old slugs, as they are essential for maintaining consistency in workspace runs and re-runs.
Solution
1. Manual Cleanup for Unused Workspaces:
If some of the workspaces are no longer active or needed, deleting these workspaces will also clean up the associated slug files. This can free up disk space immediately.
To remove a workspace from Terraform Enterprise, first, navigate to the organisation that contains the workspace you wish to delete. Once there, select the specific workspace to be removed. While within the workspace, go to the Settings dropdown menu, and choose the Destruction and Deletion option. This action will initiate the process to permanently remove the workspace from Terraform Enterprise. Example steps and further guidance can be found at the following URL
2. Archiving Unused Configurations for Mounted disk installation:
For API-based workspaces, Terraform does not automatically archive old configuration versions, since it cannot re-fetch the files. However, you can manually archive these configurations to remove older, unused slugs. This approach ensures that active workspaces still function correctly, but historical versions that are no longer needed can be purged.
3. Increase Disk Storage:
If workspaces are critical and cannot be deleted or archived, consider increasing the disk capacity allocated to Terraform Enterprise. This is a longer-term solution, allowing the server to store more slug files without causing space issues.