Problem
When using a CLI-driven workspace in Terraform Enterprise, you may encounter the following error during a plan or apply, even though the run appears to execute successfully.
╷│ Error: Failed to read JSON plan: GET https://<your_fqdn>/api/v2/plans/plan-rqvRmuvwnvmqqMCu/json-output-redacted giving up after 11 attempt(s)│ │ Terraform Cloud returned an unexpected error. Sometimes this is caused by network connection problems, in which case you could retry the│ command. If the issue persists please open a support ticket to get help resolving the problem.
Accessing the plan URL directly in a browser returns a 500 internal server error.
{
"errors": [
{
"status": "500",
"title": "internal server error"
}
]
}Prerequisites
This issue occurs under the following conditions:
- You are using a CLI-driven workspace.
- The workspace setting Structured Run Output is enabled under General Settings > User Interface.
- Your Terraform Enterprise instance uses self-signed TLS certificates.
Cause
The error is caused by an incomplete certificate chain. The Terraform Enterprise environment is using self-signed certificates, but not all required root and intermediate certificates have been added to the bundle.pem file as required by the installation documentation.
Solution
Update the Certificate Bundle
To resolve this issue, you must ensure the full certificate chain is available to your Terraform Enterprise instance.
- Access your Terraform Enterprise configuration files.
- Locate the
bundle.pemfile. - Verify that this file contains the complete certificate chain for your Terraform Enterprise environment, including all root and intermediate certificates.
- If certificates are missing, update the
bundle.pemfile with the full chain. - Apply the configuration changes and restart the Terraform Enterprise application for the changes to take effect.
Outcome
After updating the certificate bundle with the full chain, the Failed to read JSON plan error should no longer appear during CLI-driven runs.
Additional Information
For more details on certificate requirements, please refer to the Terraform Enterprise TLS Certificate documentation.