/claim #200
Adds an opt-in keepalive feature to the existing windows-rdp module that prevents workspace autostop during active RDP sessions.
When keepalive = true, a background PowerShell script (coder_script) runs on workspace start that:
keepalive_interval seconds (default: 30) using Get-NetTCPConnection -LocalPort 3389 -State EstablishedPUT /api/v2/workspaces/{workspace_id}/extend using the CODER_AGENT_TOKEN that the Coder agent sets automaticallyThis uses the manual activity bump API recommended by @matifali in https://github.com/coder/registry/issues/200#issuecomment-3461026332.
CODER_AGENT_TOKEN rather than relying on stdout/stderr, coder stat, or registry keys (which only keep the TCP connection alive but don’t tell Coder the workspace is active)keepalive = truefalse, no behavior change for existing userscoder_script resource, two new variablesmodule "windows_rdp" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/windows-rdp/coder"
version = "1.4.0"
agent_id = coder_agent.main.id
keepalive = true
keepalive_interval = 30
}
main.tf: Added keepalive (bool) and keepalive_interval (number) variables, conditional data.coder_workspace data source, and coder_script.windows-rdp-keepalive resourcerdp-keepalive.ps1.tftpl: PowerShell script that monitors port 3389 and calls the extend APImain.tftest.hcl: Terraform plan tests for the new feature (and base module)main.test.ts: TypeScript tests verifying keepalive script creation and contentREADME.md: Version bump to 1.4.0, added keep-alive usage exampleterraform test -verbose passes in the module directorybun test main.test.ts passes (keepalive script creation, content validation, interval customization)keepalive = true on a Windows workspace, connect via RDP, verify workspace deadline extends in Coder dashboardbuildingvibes
@buildingvibes
Coder
@coder
Atif Ali
@matifali