Problem
When a workspace uses an agent pool in single-execution mode, a plan operation runs successfully, but the subsequent apply operation remains in a queued state indefinitely.
Cause
This is the expected behavior for Terraform agents configured for single-execution mode. An agent in this mode is designed to perform only one operation (plan or apply) and then exit.
Because a plan and its corresponding apply are two separate operations, the agent that processes the plan will terminate upon completion. This leaves the apply operation without an available agent to process it, causing it to remain queued.
Solution
To ensure a complete run cycle can execute without interruption, you must provision at least two agents in single-execution mode within the same agent pool. This configuration allows one agent to process the plan and a second agent to become available to process the apply.
Additional Information
- For more details on agent configuration, refer to the Terraform Agents documentation.