Problem
When you attempt to generate a support bundle for Terraform Enterprise (TFE) Flexible Deployment Options (FDO) using the tfectl command, the operation fails with an unexpected EOF error.
$ tfectl support bundle Error: unexpected EOF
This process is documented in the TFE Admin CLI documentation.
Prerequisites
- Terraform Enterprise Flexible Deployment Options versions prior to
v202404-2.
Cause
The error occurs when the log directory, /var/log/terraform-enterprise, grows to a large size, approximately 2 GB or more. The tfectl command fails because it cannot upload the large log archive to the configured object storage (e.g., AWS S3, Azure Blob Storage, or Google Cloud Storage).
Solutions
Solution 1: Upgrade Terraform Enterprise
This issue is permanently resolved in Terraform Enterprise v202404-2. HashiCorp recommends upgrading to this version or later to prevent this error.
Solution 2: Generate a Local Download Link (Workaround)
For older TFE versions, you can generate the support bundle and create a local download link instead of uploading it to object storage.
- Gain access to the container command-line interface (CLI) as described in the TFE Admin CLI Access documentation.
-
Execute the following command to generate the bundle and make it available for download from the TFE instance.
$ tfe-support-bundle-generate
- Download the support bundle using the link provided in the command's output.
-
After you download the bundle, disable the download link for security.
$ tfe-support-bundle-disable-downloads
Solution 3: Manually Archive Logs (Workaround)
As an alternative, you can manually create an archive of the log directory.
- Gain access to the container CLI.
-
Create a compressed archive of the
/var/log/terraform-enterprisedirectory.$ tar -czvf tfe-logs.tar.gz /var/log/terraform-enterprise
- Transfer the archive from the container to your local machine.
Outcome
After following one of the solutions, you can successfully collect the logs from the TFE instance.