Terraform Enterprise (TFE) or Terraform Cloud (TFC) agents have limited management in the UI once they are deployed. The agents cannot be stopped or started in the UI.
Killing the shell where the agent is running or shutting down the instance may cause an orphan agent in the agent pool. To stop agents gracefully (to avoid orphaned agents in the agent pool) requires accessing the instance where the agent process is running.
Prerequisites (if applicable)
To control the TFE or TFC agent stop/start operations gracefully on the instance you can do the following
- Connect to the instance running the agent
docker psto list the active agents containers and additional information such as the name of the container. Note the name of the container
If the container is running execute a
docker stop <container-name>and check
https://$tfe-url-name/app/$orgname/settings/agentsto ensure the agent is no longer reporting in.
docker start <container-name>and to check locally if it's running
docker psand to verify
https://$tfe-url-name/app/$orgname/settings/agentsthe agents is reporting in.
- For additional assistance please contact HashiCorp Support to request additional assistance