Introduction
This document outlines methods to free up disk space when the instance that Terraform Enterprise is running on approaches the disk space limit.
Problem
These are common problems when a Terraform Enterprise instance is running out of disk space.
-
Run is errored with below message
... Error: write /...: no space left on device ...
-
Low disk warning shown from Replicated Dashboard
Low disk space! There may not be enough disk space on the following nodes: <xxx>. Please increase drive space to at least 1 GB."
-
Failure to generate or generating an empty Support Bundle
Solution
The methods described below may be used to reclaim disk space on the instance.
Remove unused Docker data
The following command will remove all unused containers, networks, dangling images, and optionally, volumes. Please double check all stopped containers and unused images, volumes, build caches, and networks before running the command:
docker system prune --volumes
Delete unused workspaces
Deleting unused workspaces can reclaim a significant amount of disk space since this operation will delete all run data associated with it (e.g. plans, states, configuration versions). Note that the garbage collection does not happen immediately, so it may take a bit of time for the disk space to be reclaimed.
The operation can be done in Terraform Enterprise Workspace Settings or automated via Delete Workspace API
Other preventive approaches
- Review Terraform configuration directory and add unnecessary paths to
.terraformignore
- Moderate usage of mono repo configuration
- Configure Docker log-rotation
- Configure
journald
log-rotation