You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Research and document how to gracefully shut down agents using different terraform providers (update templates) #6174
To ensure workspaces (and agents) are stopped gracefully, we want to make sure Terraform providers are configured in a way that tries (best-effort) to respect the agent shutdown procedure.
What does graceful shutdown mean? It means the provider issues a kill -INT [coder_agent_pid] (one of HUP, INT, TERM) when the resource is stopped. After a specified timeout, it may issue kill -KILL [coder_agent_pid] to ensure de-provision progresses.
Note: This will not be the primary form of ensuring an agent is stopped gracefully. In the ideal scenario, this happens in a pre-provision step and this acts as a safety net (#6175).
We need to figure out how to perform graceful shutdown with (or verify that it works):
EDIT: It looks like destroy_grace_seconds is required to trigger a graceful stop, stop_{timeout,signal} is insufficient alone. It may be that stop_{timeout,signal} can be omitted in normal use-cases though (needs verification).
I think the Coder server should be responsible for determining when an agent is disconnected, not the other way around. For example, if I unplug a server that is running a Coder workspace, Coder should know about this (and report it via workspace state) within 10 seconds.
resource"kubernetes_pod""main" {
# Set the pod delete timeout to termination_grace_period_seconds + 1m# to give it some breathing room.timeouts {
delete="31m"
}
spec {
termination_grace_period_seconds=1800
}
}
changed the title [-]Research and document how to gracefully shut down agents using different terraform providers (update templates)[/-][+]Graceful Shutdown for Agents[/+]on Sep 26, 2025
changed the title [-]Graceful Shutdown for Agents[/-][+]Research and document how to gracefully shut down agents using different terraform providers (update templates)[/+]on Sep 26, 2025
Activity
bpmct commentedon Mar 6, 2023
I think the Coder server should be responsible for determining when an agent is disconnected, not the other way around. For example, if I unplug a server that is running a Coder workspace, Coder should know about this (and report it via workspace state) within 10 seconds.
mafredri commentedon Sep 11, 2023
For the terraform-provider-kubernetes provider, we can do the following:
mafredri commentedon Sep 26, 2024
Reopening this as we still haven't documented these or implemented an alternative (e.g. #6175).
[-]Research and document how to gracefully shut down agents using different terraform providers (update templates)[/-][+]Graceful Shutdown for Agents[/+][-]Graceful Shutdown for Agents[/-][+]Research and document how to gracefully shut down agents using different terraform providers (update templates)[/+]nickvigilante commentedon May 29, 2026
This issue has been migrated to the Coder docs backlog in Linear as DOCS-307. Closing here to consolidate tracking.