Introduction
Terraform agents in single-execution mode perform one operation at a time. Plan and apply are separate operations and would require a single-execution mode agent per operation.
Scenario
When an agent is placed in single-execution mode, if the plan and apply operation are queued from the UI, after the plan has completed its function, a single-execution mode agent will exit, leaving the apply operation without an agent to process against. The apply operation will then enter a queued state until an agent process is available. This is the expected behavior as agents in single-execution mode perform one operation at a time.
Recommendation
To get around this you’d need to create two distinct agents in single execution mode, under the same agent pool that is configured for the associated workspace execution mode to work through a whole queue plan and apply run operation.
Additional Information
- Related supplementary agent documentation can be found at this location https://developer.hashicorp.com/terraform/cloud-docs/agents/agents
- For additional assistance please contact HashiCorp Support.