Problem
In Terraform Enterprise version v202302-1, runs that use the agent execution mode may become stuck in the Plan Queued state.
The tfe-task-worker container log displays an error message indicating that agent registration failed with a 404 Not Found status.
{
"@level": "info",
"@message": "[ERROR] agent: Failed starting core plugin: error=\"failed configuring core: agent registration failed: POST https://<tfe-hostname>/api/agent/register: unexpected status code (404 Not Found)\"",
"@module": "tfe-task-worker.executor.task-output"
}Cause
This issue occurs when an organization is configured to use the agent run pipeline mode, but the global Enable agents setting has been disabled in the Terraform Enterprise admin settings. When this setting is disabled, Terraform Enterprise cannot communicate with agents, causing all agent-based runs to remain queued indefinitely.
Solutions
Solution 1: Enable Terraform Agents in Admin Settings
You must re-enable the agent functionality in the Terraform Enterprise admin settings to resolve this issue.
- Navigate to the Terraform Enterprise Admin Settings page at
https://<TFE_HOSTNAME>/app/admin/settings. - Select the Terraform Agents tab.
-
Check the box for Enable agents.
This setting allows agents to connect to the internal Terraform Enterprise instance and process runs.
Outcome
After you enable the setting, you must cancel any runs that are currently stuck in the queue. Triggering a new run will now result in a successful plan and apply.
Additional Information
This issue was resolved in Terraform Enterprise version v202303-1.
- For more details, refer to the TFE release notes for v202302-1.