Problem
An API call to show the current state version outputs for a workspace returns a 503 service unavailable error.
Example Request:
$ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/workspaces/ws-XXXX/current-state-version-outputs
Error Response:
{
"errors": [
{
"status": "503",
"title": "service unavailable",
"detail": "Please wait while outputs are parsed from the latest state version",
"retry_after_sec": "3"
}
]
}Prerequisites
- Terraform Enterprise (TFE) on Kubernetes, version 1.0.1 or 1.0.2.
- The TFE application has been running for more than 24 hours.
- You have waited a reasonable amount of time for the outputs to parse, based on the number of resources in the workspace.
Cause
This error is caused by an internal bug where the resources-processed flag in the state version does not update to true.
You can check the value of this flag using the API.
Example Request:
$ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/workspaces/<ws-XXXX>/current-state-version
Example Output:
{
// ...
"resources-processed": false,
// ...
}Solutions
This issue is permanently resolved by upgrading to Terraform Enterprise v1.0.3 or newer. If you cannot upgrade immediately, you may use one of the following workarounds.
Solution 1: Disable Usage Reporting (Preferred Workaround)
In your Terraform Enterprise configuration file, add the environment variable TFE_USAGE_REPORTING_DISABLED=true.
Note: This will disable TFE product usage reporting.
Solution 2: Restart the Terraform Enterprise Pod
You can temporarily resolve the issue by restarting the terraform-enterprise pod.
Note: This workaround must be repeated each time the error reappears.
Solution 3: Restart the Sidekiq Process
Restart the sidekiq process inside the Terraform Enterprise container.
# supervisorctl restart tfe:sidekiq
Note: This workaround must be repeated each time the error reappears.
Solution 4: Upgrade Terraform Enterprise (Permanent Fix)
Upgrade your Terraform Enterprise instance to version 1.0.3 or newer to permanently resolve this bug.
Outcome
After applying a solution, the API call to retrieve workspace outputs will succeed.