From dc0f6d04d30e22e21f6ff22d344783c654a38fa1 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 24 May 2025 02:15:13 +0000 Subject: [PATCH 01/18] feat(local-windows-rdp): add initial RDP module for Coder workspaces utilizing coder Desktop --- .../coder/modules/local-windows-rdp/main.tf | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 registry/coder/modules/local-windows-rdp/main.tf diff --git a/registry/coder/modules/local-windows-rdp/main.tf b/registry/coder/modules/local-windows-rdp/main.tf new file mode 100644 index 000000000..0b59fc9e7 --- /dev/null +++ b/registry/coder/modules/local-windows-rdp/main.tf @@ -0,0 +1,70 @@ +terraform { + required_version = ">= 1.0" + + required_providers { + coder = { + source = "coder/coder" + version = ">= 0.17" + } + } +} + +variable "agent_id" { + type = string + description = "The ID of a Coder agent." +} + +variable "agent_name" { + type = string + description = "The name of the Coder agent." + default = "main" +} + +variable "username" { + type = string + description = "The username for RDP authentication." + default = "Administrator" +} + +variable "password" { + type = string + description = "The password for RDP authentication." + default = "coderRDP!" + sensitive = true +} + +variable "display_name" { + type = string + description = "The display name for the RDP app button." + default = "RDP Desktop" +} + +variable "order" { + type = number + description = "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order)." + default = null +} + +locals { + # Extract server name from workspace access URL + server_name = regex("https?:\\/\\/([^\\/]+)", data.coder_workspace.me.access_url)[0] +} + +data "coder_workspace" "me" {} + +resource "coder_app" "rdp_desktop" { + agent_id = var.agent_id + slug = "rdp-desktop" + display_name = var.display_name + url = "coder://${local.server_name}/v0/open/ws/${data.coder_workspace.me.name}/agent/${var.agent_name}/rdp?username=${var.username}&password=${var.password}" + icon = "/icon/desktop.svg" + external = true + order = var.order +} + +output "app" { + description = "The created RDP desktop app resource" + value = coder_app.rdp_desktop + sensitive = true +} + From dace4933c566f42eb3368db75b74d2bcb556b27a Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 24 May 2025 02:15:30 +0000 Subject: [PATCH 02/18] feat(local-windows-rdp): add comprehensive test suite for RDP module --- .../modules/local-windows-rdp/main.test.ts | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 registry/coder/modules/local-windows-rdp/main.test.ts diff --git a/registry/coder/modules/local-windows-rdp/main.test.ts b/registry/coder/modules/local-windows-rdp/main.test.ts new file mode 100644 index 000000000..a4e061359 --- /dev/null +++ b/registry/coder/modules/local-windows-rdp/main.test.ts @@ -0,0 +1,124 @@ +import { describe, expect, it } from "bun:test"; +import { + type TerraformState, + runTerraformApply, + runTerraformInit, + testRequiredVariables, +} from "~test"; + +type TestVariables = Readonly<{ + agent_id: string; + agent_name?: string; + username?: string; + password?: string; + display_name?: string; + order?: number; +}>; + +function findRdpApp(state: TerraformState) { + for (const resource of state.resources) { + const isRdpAppResource = + resource.type === "coder_app" && resource.name === "rdp_desktop"; + + if (!isRdpAppResource) { + continue; + } + + for (const instance of resource.instances) { + if (instance.attributes.slug === "rdp-desktop") { + return instance.attributes; + } + } + } + + return null; +} + +describe("local-windows-rdp", async () => { + await runTerraformInit(import.meta.dir); + + testRequiredVariables(import.meta.dir, { + agent_id: "test-agent-id", + }); + + it("should create RDP app with default values", async () => { + const state = await runTerraformApply(import.meta.dir, { + agent_id: "test-agent-id", + }); + + const app = findRdpApp(state); + + // Verify the app was created + expect(app).not.toBeNull(); + expect(app?.slug).toBe("rdp-desktop"); + expect(app?.display_name).toBe("RDP Desktop"); + expect(app?.icon).toBe("/icon/desktop.svg"); + expect(app?.external).toBe(true); + + // Verify the URI format + expect(app?.url).toStartWith("coder://"); + expect(app?.url).toContain("/v0/open/ws/"); + expect(app?.url).toContain("/agent/main/rdp"); + expect(app?.url).toContain("username=Administrator"); + expect(app?.url).toContain("password=coderRDP!"); + }); + + it("should create RDP app with custom values", async () => { + const state = await runTerraformApply(import.meta.dir, { + agent_id: "custom-agent-id", + agent_name: "windows-agent", + username: "CustomUser", + password: "CustomPass123!", + display_name: "Custom RDP", + order: 5, + }); + + const app = findRdpApp(state); + + // Verify custom values + expect(app?.display_name).toBe("Custom RDP"); + expect(app?.order).toBe(5); + + // Verify custom credentials in URI + expect(app?.url).toContain("/agent/windows-agent/rdp"); + expect(app?.url).toContain("username=CustomUser"); + expect(app?.url).toContain("password=CustomPass123!"); + }); + + it("should handle sensitive password variable", async () => { + const state = await runTerraformApply(import.meta.dir, { + agent_id: "test-agent-id", + password: "SensitivePass123!", + }); + + const app = findRdpApp(state); + + // Verify password is included in URI even when sensitive + expect(app?.url).toContain("password=SensitivePass123!"); + }); + + it("should use correct default agent name", async () => { + const state = await runTerraformApply(import.meta.dir, { + agent_id: "test-agent-id", + }); + + const app = findRdpApp(state); + expect(app?.url).toContain("/agent/main/rdp"); + }); + + it("should construct proper Coder URI format", async () => { + const state = await runTerraformApply(import.meta.dir, { + agent_id: "test-agent-id", + agent_name: "test-agent", + username: "TestUser", + password: "TestPass", + }); + + const app = findRdpApp(state); + + // Verify complete URI structure + expect(app?.url).toMatch( + /^coder:\/\/[^\/]+\/v0\/open\/ws\/[^\/]+\/agent\/test-agent\/rdp\?username=TestUser&password=TestPass$/, + ); + }); +}); From 14ea2b7853d49f12e0f7ab5dddf4942d5626b239 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 24 May 2025 02:15:48 +0000 Subject: [PATCH 03/18] feat(local-windows-rdp): add README for Windows RDP Desktop module with usage examples and requirements --- .../coder/modules/local-windows-rdp/README.md | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 registry/coder/modules/local-windows-rdp/README.md diff --git a/registry/coder/modules/local-windows-rdp/README.md b/registry/coder/modules/local-windows-rdp/README.md new file mode 100644 index 000000000..0cdb2b37e --- /dev/null +++ b/registry/coder/modules/local-windows-rdp/README.md @@ -0,0 +1,75 @@ +--- +display_name: Windows RDP Desktop +description: Add a one-click RDP Desktop button using Coder Desktop URI functionality +icon: ../../../../.icons/desktop.svg +maintainer_github: coder +verified: true +tags: [rdp, windows, desktop] +--- + +# Windows RDP Desktop + +This module adds a one-click button to launch Remote Desktop Protocol (RDP) sessions directly through Coder Desktop using URI handling. This provides seamless RDP access without requiring manual port forwarding. + +```tf +module "rdp_desktop" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/coder/local-windows-rdp/coder" + version = "1.0.0" + agent_id = coder_agent.main.id +} +``` + +## Requirements + +- **Coder Desktop**: This module requires [Coder Desktop](https://github.com/coder/coder/releases) to be installed on the client machine +- **Windows Workspace**: The target workspace must be running Windows with RDP enabled +- **Agent**: A Coder agent must be running on the Windows workspace + +## Features + +- ✅ One-click RDP access through Coder Desktop +- ✅ No manual port forwarding required +- ✅ Configurable authentication credentials +- ✅ Customizable display name and ordering +- ✅ Secure credential handling + +## Examples + +### Basic Usage + +```tf +module "rdp_desktop" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/coder/local-windows-rdp/coder" + version = "1.0.0" + agent_id = coder_agent.main.id +} +``` + +### Custom Credentials + +```tf +module "rdp_desktop" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/coder/local-windows-rdp/coder" + version = "1.0.0" + agent_id = coder_agent.main.id + username = "MyUser" + password = "MySecurePassword123!" +} +``` + +### Custom Display and Agent + +```tf +module "rdp_desktop" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/coder/local-windows-rdp/coder" + version = "1.0.0" + agent_id = coder_agent.windows.id + agent_name = "windows" + display_name = "Windows Desktop" + order = 1 +} +``` From c0832a1615d8f1d8af0fee0ebed37afb6a2e742b Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 24 May 2025 03:15:51 +0000 Subject: [PATCH 04/18] feat(local-windows-rdp): add RDP setup script resource and output --- .../coder/modules/local-windows-rdp/main.tf | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/registry/coder/modules/local-windows-rdp/main.tf b/registry/coder/modules/local-windows-rdp/main.tf index 0b59fc9e7..e3e3910fd 100644 --- a/registry/coder/modules/local-windows-rdp/main.tf +++ b/registry/coder/modules/local-windows-rdp/main.tf @@ -52,6 +52,17 @@ locals { data "coder_workspace" "me" {} +resource "coder_script" "rdp_setup" { + agent_id = var.agent_id + display_name = "Configure RDP" + icon = "/icon/desktop.svg" + script = templatefile("${path.module}/configure-rdp.ps1", { + username = var.username + password = var.password + }) + run_on_start = true +} + resource "coder_app" "rdp_desktop" { agent_id = var.agent_id slug = "rdp-desktop" @@ -68,3 +79,9 @@ output "app" { sensitive = true } +output "script" { + description = "The RDP configuration script resource" + value = coder_script.rdp_setup + sensitive = true +} + From 639b4a2187a81b1a8ac912d75e7cd2c05813e993 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 24 May 2025 03:16:14 +0000 Subject: [PATCH 05/18] feat(local-windows-rdp): add PowerShell script for RDP configuration and setup --- .../local-windows-rdp/configure-rdp.ps1 | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 registry/coder/modules/local-windows-rdp/configure-rdp.ps1 diff --git a/registry/coder/modules/local-windows-rdp/configure-rdp.ps1 b/registry/coder/modules/local-windows-rdp/configure-rdp.ps1 new file mode 100644 index 000000000..34a3b3ec9 --- /dev/null +++ b/registry/coder/modules/local-windows-rdp/configure-rdp.ps1 @@ -0,0 +1,120 @@ +# PowerShell script to configure RDP for Coder Desktop access +# This script enables RDP, sets the admin password, and configures necessary settings + +Write-Output "[Coder RDP Setup] Starting RDP configuration..." + +# Function to set the administrator password +function Set-AdminPassword { + param ( + [string]$adminUsername, + [string]$adminPassword + ) + + Write-Output "[Coder RDP Setup] Setting password for user: $adminUsername" + + try { + # Convert password to secure string + $securePassword = ConvertTo-SecureString -AsPlainText $adminPassword -Force + + # Set the password for the user + Get-LocalUser -Name $adminUsername | Set-LocalUser -Password $securePassword + + # Enable the user account (in case it's disabled) + Get-LocalUser -Name $adminUsername | Enable-LocalUser + + Write-Output "[Coder RDP Setup] Successfully set password for $adminUsername" + } catch { + Write-Error "[Coder RDP Setup] Failed to set password: $_" + exit 1 + } +} + +# Function to enable and configure RDP +function Enable-RDP { + Write-Output "[Coder RDP Setup] Enabling Remote Desktop..." + + try { + # Enable RDP + Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name "fDenyTSConnections" -Value 0 -Force + + # Disable Network Level Authentication (NLA) for easier access + Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name "UserAuthentication" -Value 0 -Force + + # Set security layer to RDP Security Layer + Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name "SecurityLayer" -Value 1 -Force + + Write-Output "[Coder RDP Setup] RDP enabled successfully" + } catch { + Write-Error "[Coder RDP Setup] Failed to enable RDP: $_" + exit 1 + } +} + +# Function to configure Windows Firewall for RDP +function Configure-Firewall { + Write-Output "[Coder RDP Setup] Configuring Windows Firewall for RDP..." + + try { + # Enable RDP firewall rules + Enable-NetFirewallRule -DisplayGroup "Remote Desktop" -ErrorAction SilentlyContinue + + # If the above fails, try alternative method + if ($LASTEXITCODE -ne 0) { + netsh advfirewall firewall set rule group="remote desktop" new enable=Yes + } + + Write-Output "[Coder RDP Setup] Firewall configured successfully" + } catch { + Write-Warning "[Coder RDP Setup] Failed to configure firewall rules: $_" + # Continue anyway as RDP might still work + } +} + +# Function to ensure RDP service is running +function Start-RDPService { + Write-Output "[Coder RDP Setup] Starting Remote Desktop Services..." + + try { + # Start the Terminal Services + Set-Service -Name "TermService" -StartupType Automatic -ErrorAction SilentlyContinue + Start-Service -Name "TermService" -ErrorAction SilentlyContinue + + # Start Remote Desktop Services UserMode Port Redirector + Set-Service -Name "UmRdpService" -StartupType Automatic -ErrorAction SilentlyContinue + Start-Service -Name "UmRdpService" -ErrorAction SilentlyContinue + + Write-Output "[Coder RDP Setup] RDP services started successfully" + } catch { + Write-Warning "[Coder RDP Setup] Some RDP services may not have started: $_" + # Continue anyway + } +} + +# Main execution +try { + # Template variables from Terraform + $username = "${username}" + $password = "${password}" + + # Validate inputs + if ([string]::IsNullOrWhiteSpace($username) -or [string]::IsNullOrWhiteSpace($password)) { + Write-Error "[Coder RDP Setup] Username or password is empty" + exit 1 + } + + # Execute configuration steps + Set-AdminPassword -adminUsername $username -adminPassword $password + Enable-RDP + Configure-Firewall + Start-RDPService + + Write-Output "[Coder RDP Setup] RDP configuration completed successfully!" + Write-Output "[Coder RDP Setup] You can now connect using:" + Write-Output " Username: $username" + Write-Output " Password: [hidden]" + Write-Output " Port: 3389 (default)" + +} catch { + Write-Error "[Coder RDP Setup] An unexpected error occurred: $_" + exit 1 +} \ No newline at end of file From 3bea8a7e13f74ea99c075970fb9bc2a97789e891 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 24 May 2025 03:18:22 +0000 Subject: [PATCH 06/18] feat(local-windows-rdp): enhance test suite with RDP script validation and custom credential checks --- .../modules/local-windows-rdp/main.test.ts | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/registry/coder/modules/local-windows-rdp/main.test.ts b/registry/coder/modules/local-windows-rdp/main.test.ts index a4e061359..10f3a950e 100644 --- a/registry/coder/modules/local-windows-rdp/main.test.ts +++ b/registry/coder/modules/local-windows-rdp/main.test.ts @@ -34,6 +34,25 @@ function findRdpApp(state: TerraformState) { return null; } +function findRdpScript(state: TerraformState) { + for (const resource of state.resources) { + const isRdpScriptResource = + resource.type === "coder_script" && resource.name === "rdp_setup"; + + if (!isRdpScriptResource) { + continue; + } + + for (const instance of resource.instances) { + if (instance.attributes.display_name === "Configure RDP") { + return instance.attributes; + } + } + } + + return null; +} + describe("local-windows-rdp", async () => { await runTerraformInit(import.meta.dir); @@ -63,6 +82,27 @@ describe("local-windows-rdp", async () => { expect(app?.url).toContain("password=coderRDP!"); }); + it("should create RDP configuration script", async () => { + const state = await runTerraformApply(import.meta.dir, { + agent_id: "test-agent-id", + }); + + const script = findRdpScript(state); + + // Verify the script was created + expect(script).not.toBeNull(); + expect(script?.display_name).toBe("Configure RDP"); + expect(script?.icon).toBe("/icon/desktop.svg"); + expect(script?.run_on_start).toBe(true); + expect(script?.run_on_stop).toBe(false); + + // Verify the script contains PowerShell configuration + expect(script?.script).toContain("Set-AdminPassword"); + expect(script?.script).toContain("Enable-RDP"); + expect(script?.script).toContain("Configure-Firewall"); + expect(script?.script).toContain("Start-RDPService"); + }); + it("should create RDP app with custom values", async () => { const state = await runTerraformApply(import.meta.dir, { agent_id: "custom-agent-id", @@ -85,6 +125,20 @@ describe("local-windows-rdp", async () => { expect(app?.url).toContain("password=CustomPass123!"); }); + it("should pass custom credentials to PowerShell script", async () => { + const state = await runTerraformApply(import.meta.dir, { + agent_id: "test-agent-id", + username: "TestAdmin", + password: "TestPassword123!", + }); + + const script = findRdpScript(state); + + // Verify custom credentials are in the script + expect(script?.script).toContain('$username = "TestAdmin"'); + expect(script?.script).toContain('$password = "TestPassword123!"'); + }); + it("should handle sensitive password variable", async () => { const state = await runTerraformApply(import.meta.dir, { agent_id: "test-agent-id", From d42de1d91d9af461768b029b76282db26a3c0588 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 24 May 2025 03:18:31 +0000 Subject: [PATCH 07/18] feat(local-windows-rdp): update README to enhance module description, features, and requirements for RDP access --- .../coder/modules/local-windows-rdp/README.md | 45 ++++++++++++------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/registry/coder/modules/local-windows-rdp/README.md b/registry/coder/modules/local-windows-rdp/README.md index 0cdb2b37e..2016f0626 100644 --- a/registry/coder/modules/local-windows-rdp/README.md +++ b/registry/coder/modules/local-windows-rdp/README.md @@ -1,15 +1,15 @@ --- display_name: Windows RDP Desktop -description: Add a one-click RDP Desktop button using Coder Desktop URI functionality +description: Enable RDP on Windows and add a one-click Coder Desktop button for seamless access icon: ../../../../.icons/desktop.svg maintainer_github: coder -verified: true -tags: [rdp, windows, desktop] +verified: false +tags: [rdp, windows, desktop, remote] --- # Windows RDP Desktop -This module adds a one-click button to launch Remote Desktop Protocol (RDP) sessions directly through Coder Desktop using URI handling. This provides seamless RDP access without requiring manual port forwarding. +This module enables Remote Desktop Protocol (RDP) on Windows workspaces and adds a one-click button to launch RDP sessions directly through Coder Desktop. It provides a complete, standalone solution for RDP access without requiring manual configuration or port forwarding. ```tf module "rdp_desktop" { @@ -20,24 +20,35 @@ module "rdp_desktop" { } ``` -## Requirements +## Features -- **Coder Desktop**: This module requires [Coder Desktop](https://github.com/coder/coder/releases) to be installed on the client machine -- **Windows Workspace**: The target workspace must be running Windows with RDP enabled -- **Agent**: A Coder agent must be running on the Windows workspace +- ✅ **Standalone Solution**: Automatically configures RDP on Windows workspaces +- ✅ **One-click Access**: Launch RDP sessions directly through Coder Desktop +- ✅ **No Port Forwarding**: Uses Coder Desktop URI handling +- ✅ **Auto-configuration**: Sets up Windows firewall, services, and authentication +- ✅ **Secure**: Configurable credentials with sensitive variable handling +- ✅ **Customizable**: Display name, credentials, and UI ordering options -## Features +## What This Module Does -- ✅ One-click RDP access through Coder Desktop -- ✅ No manual port forwarding required -- ✅ Configurable authentication credentials -- ✅ Customizable display name and ordering -- ✅ Secure credential handling +1. **Enables RDP** on the Windows workspace +2. **Sets the administrator password** for RDP authentication +3. **Configures Windows Firewall** to allow RDP connections +4. **Starts RDP services** automatically +5. **Creates a Coder Desktop button** for one-click access + +## Requirements + +- **Coder Desktop**: Must be installed on the client machine ([Download here](https://github.com/coder/coder/releases)) +- **Windows Workspace**: The target workspace must be running Windows +- **Coder Agent**: Must be running on the Windows workspace ## Examples ### Basic Usage +Uses default credentials (Username: `Administrator`, Password: `coderRDP!`): + ```tf module "rdp_desktop" { count = data.coder_workspace.me.start_count @@ -49,19 +60,23 @@ module "rdp_desktop" { ### Custom Credentials +Set your own username and password: + ```tf module "rdp_desktop" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/local-windows-rdp/coder" version = "1.0.0" agent_id = coder_agent.main.id - username = "MyUser" + username = "MyAdmin" password = "MySecurePassword123!" } ``` ### Custom Display and Agent +Configure display name and specify a different agent: + ```tf module "rdp_desktop" { count = data.coder_workspace.me.start_count From 30bf0b7d1e643770d971b5e9e2327d1968b21a77 Mon Sep 17 00:00:00 2001 From: DevCats Date: Thu, 29 May 2025 20:02:27 -0500 Subject: [PATCH 08/18] Update registry/coder/modules/local-windows-rdp/README.md Co-authored-by: Atif Ali --- registry/coder/modules/local-windows-rdp/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder/modules/local-windows-rdp/README.md b/registry/coder/modules/local-windows-rdp/README.md index 2016f0626..2f01e5a17 100644 --- a/registry/coder/modules/local-windows-rdp/README.md +++ b/registry/coder/modules/local-windows-rdp/README.md @@ -3,7 +3,7 @@ display_name: Windows RDP Desktop description: Enable RDP on Windows and add a one-click Coder Desktop button for seamless access icon: ../../../../.icons/desktop.svg maintainer_github: coder -verified: false +verified: true tags: [rdp, windows, desktop, remote] --- From 9968c3ddf7b50c74c384888d40e480ec90b03578 Mon Sep 17 00:00:00 2001 From: DevCats Date: Thu, 29 May 2025 20:02:51 -0500 Subject: [PATCH 09/18] Update registry/coder/modules/local-windows-rdp/main.tf Co-authored-by: Atif Ali --- registry/coder/modules/local-windows-rdp/main.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/registry/coder/modules/local-windows-rdp/main.tf b/registry/coder/modules/local-windows-rdp/main.tf index e3e3910fd..b551c7873 100644 --- a/registry/coder/modules/local-windows-rdp/main.tf +++ b/registry/coder/modules/local-windows-rdp/main.tf @@ -17,7 +17,6 @@ variable "agent_id" { variable "agent_name" { type = string description = "The name of the Coder agent." - default = "main" } variable "username" { From 41dbc181a5eacf06f78aab8247347cfc657a7990 Mon Sep 17 00:00:00 2001 From: DevCats Date: Thu, 29 May 2025 20:04:06 -0500 Subject: [PATCH 10/18] Update registry/coder/modules/local-windows-rdp/main.tf Co-authored-by: Atif Ali --- registry/coder/modules/local-windows-rdp/main.tf | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/registry/coder/modules/local-windows-rdp/main.tf b/registry/coder/modules/local-windows-rdp/main.tf index b551c7873..ae0136ddb 100644 --- a/registry/coder/modules/local-windows-rdp/main.tf +++ b/registry/coder/modules/local-windows-rdp/main.tf @@ -72,15 +72,3 @@ resource "coder_app" "rdp_desktop" { order = var.order } -output "app" { - description = "The created RDP desktop app resource" - value = coder_app.rdp_desktop - sensitive = true -} - -output "script" { - description = "The RDP configuration script resource" - value = coder_script.rdp_setup - sensitive = true -} - From 1ffa9fa8ce2cf1fb114c54918487bd30f6f417ba Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 30 May 2025 01:36:45 +0000 Subject: [PATCH 11/18] chore(local-windows-rdp): Removed Stale Requirements, Add required agent_name variable, Refine examples for clarity --- .../coder/modules/local-windows-rdp/README.md | 41 ++++++------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/registry/coder/modules/local-windows-rdp/README.md b/registry/coder/modules/local-windows-rdp/README.md index 2f01e5a17..c995bf76e 100644 --- a/registry/coder/modules/local-windows-rdp/README.md +++ b/registry/coder/modules/local-windows-rdp/README.md @@ -13,10 +13,11 @@ This module enables Remote Desktop Protocol (RDP) on Windows workspaces and adds ```tf module "rdp_desktop" { - count = data.coder_workspace.me.start_count - source = "registry.coder.com/coder/local-windows-rdp/coder" - version = "1.0.0" - agent_id = coder_agent.main.id + count = data.coder_workspace.me.start_count + source = "registry.coder.com/coder/local-windows-rdp/coder" + version = "1.0.0" + agent_id = coder_agent.main.id + agent_name = coder_agent.main.name } ``` @@ -39,9 +40,7 @@ module "rdp_desktop" { ## Requirements -- **Coder Desktop**: Must be installed on the client machine ([Download here](https://github.com/coder/coder/releases)) -- **Windows Workspace**: The target workspace must be running Windows -- **Coder Agent**: Must be running on the Windows workspace +- **Coder Desktop**: Must be installed on the client machine ([Download here](https://coder.com/docs/user-guides/desktop)) ## Examples @@ -51,31 +50,17 @@ Uses default credentials (Username: `Administrator`, Password: `coderRDP!`): ```tf module "rdp_desktop" { - count = data.coder_workspace.me.start_count - source = "registry.coder.com/coder/local-windows-rdp/coder" - version = "1.0.0" - agent_id = coder_agent.main.id + count = data.coder_workspace.me.start_count + source = "registry.coder.com/coder/local-windows-rdp/coder" + version = "1.0.0" + agent_id = coder_agent.main.id + agent_name = coder_agent.main.name } ``` -### Custom Credentials +### Custom display name -Set your own username and password: - -```tf -module "rdp_desktop" { - count = data.coder_workspace.me.start_count - source = "registry.coder.com/coder/local-windows-rdp/coder" - version = "1.0.0" - agent_id = coder_agent.main.id - username = "MyAdmin" - password = "MySecurePassword123!" -} -``` - -### Custom Display and Agent - -Configure display name and specify a different agent: +Specify a custom display name for the `coder_app` button: ```tf module "rdp_desktop" { From b8f0c910b7abfd491670864a5cfdf00d36dce0cc Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 30 May 2025 01:37:05 +0000 Subject: [PATCH 12/18] fix(local-windows-rdp): Update agent_name variable to be required in tests and adjust test cases accordingly --- registry/coder/modules/local-windows-rdp/main.test.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/registry/coder/modules/local-windows-rdp/main.test.ts b/registry/coder/modules/local-windows-rdp/main.test.ts index 10f3a950e..75b6dde0f 100644 --- a/registry/coder/modules/local-windows-rdp/main.test.ts +++ b/registry/coder/modules/local-windows-rdp/main.test.ts @@ -8,7 +8,7 @@ import { type TestVariables = Readonly<{ agent_id: string; - agent_name?: string; + agent_name: string; username?: string; password?: string; display_name?: string; @@ -58,11 +58,13 @@ describe("local-windows-rdp", async () => { testRequiredVariables(import.meta.dir, { agent_id: "test-agent-id", + agent_name: "test-agent", }); it("should create RDP app with default values", async () => { const state = await runTerraformApply(import.meta.dir, { agent_id: "test-agent-id", + agent_name: "main", }); const app = findRdpApp(state); @@ -85,6 +87,7 @@ describe("local-windows-rdp", async () => { it("should create RDP configuration script", async () => { const state = await runTerraformApply(import.meta.dir, { agent_id: "test-agent-id", + agent_name: "main", }); const script = findRdpScript(state); @@ -128,6 +131,7 @@ describe("local-windows-rdp", async () => { it("should pass custom credentials to PowerShell script", async () => { const state = await runTerraformApply(import.meta.dir, { agent_id: "test-agent-id", + agent_name: "main", username: "TestAdmin", password: "TestPassword123!", }); @@ -142,6 +146,7 @@ describe("local-windows-rdp", async () => { it("should handle sensitive password variable", async () => { const state = await runTerraformApply(import.meta.dir, { agent_id: "test-agent-id", + agent_name: "main", password: "SensitivePass123!", }); @@ -154,6 +159,7 @@ describe("local-windows-rdp", async () => { it("should use correct default agent name", async () => { const state = await runTerraformApply(import.meta.dir, { agent_id: "test-agent-id", + agent_name: "main", }); const app = findRdpApp(state); From d986db0ddee0ad6f6a19895e3e8fe57480db44f8 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Wed, 11 Jun 2025 15:12:31 +0500 Subject: [PATCH 13/18] add `group` --- registry/coder/modules/local-windows-rdp/main.tf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/registry/coder/modules/local-windows-rdp/main.tf b/registry/coder/modules/local-windows-rdp/main.tf index ae0136ddb..9c89adef3 100644 --- a/registry/coder/modules/local-windows-rdp/main.tf +++ b/registry/coder/modules/local-windows-rdp/main.tf @@ -44,6 +44,12 @@ variable "order" { default = null } +variable "group" { + type = string + description = "The name of a group that this app belongs to." + default = null +} + locals { # Extract server name from workspace access URL server_name = regex("https?:\\/\\/([^\\/]+)", data.coder_workspace.me.access_url)[0] @@ -70,5 +76,6 @@ resource "coder_app" "rdp_desktop" { icon = "/icon/desktop.svg" external = true order = var.order + group = var.group } From 52eb3f52bb068a9eb8d7581c8208be2fad4060d7 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Wed, 11 Jun 2025 15:12:52 +0500 Subject: [PATCH 14/18] Update main.tf --- registry/coder/modules/local-windows-rdp/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder/modules/local-windows-rdp/main.tf b/registry/coder/modules/local-windows-rdp/main.tf index 9c89adef3..b5f594455 100644 --- a/registry/coder/modules/local-windows-rdp/main.tf +++ b/registry/coder/modules/local-windows-rdp/main.tf @@ -4,7 +4,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = ">= 0.17" + version = ">= 2.5" } } } From 80351eb6433a557db7b5ca6402fffeef2dc84055 Mon Sep 17 00:00:00 2001 From: DevCats Date: Mon, 16 Jun 2025 20:11:28 -0500 Subject: [PATCH 15/18] chore(README): update frontmatter with coder desktop requirement and supported os Co-authored-by: Atif Ali --- registry/coder/modules/local-windows-rdp/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/registry/coder/modules/local-windows-rdp/README.md b/registry/coder/modules/local-windows-rdp/README.md index c995bf76e..dd256526b 100644 --- a/registry/coder/modules/local-windows-rdp/README.md +++ b/registry/coder/modules/local-windows-rdp/README.md @@ -4,6 +4,8 @@ description: Enable RDP on Windows and add a one-click Coder Desktop button for icon: ../../../../.icons/desktop.svg maintainer_github: coder verified: true +coder_desktop: true +supported_os: [windows] tags: [rdp, windows, desktop, remote] --- From d331c291c7a5116bee6685dbcae84f4efd6f0377 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Tue, 17 Jun 2025 02:37:22 +0000 Subject: [PATCH 16/18] chore(README): remove requirements in documentation in favor of frontmatter --- registry/coder/modules/local-windows-rdp/README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/registry/coder/modules/local-windows-rdp/README.md b/registry/coder/modules/local-windows-rdp/README.md index dd256526b..67dca415b 100644 --- a/registry/coder/modules/local-windows-rdp/README.md +++ b/registry/coder/modules/local-windows-rdp/README.md @@ -40,10 +40,6 @@ module "rdp_desktop" { 4. **Starts RDP services** automatically 5. **Creates a Coder Desktop button** for one-click access -## Requirements - -- **Coder Desktop**: Must be installed on the client machine ([Download here](https://coder.com/docs/user-guides/desktop)) - ## Examples ### Basic Usage From 2736547257e3ad085b63d024b754d0dd45f4ff27 Mon Sep 17 00:00:00 2001 From: DevCats Date: Fri, 20 Jun 2025 12:58:10 -0500 Subject: [PATCH 17/18] chore: update Readme description for module Co-authored-by: Atif Ali --- registry/coder/modules/local-windows-rdp/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder/modules/local-windows-rdp/README.md b/registry/coder/modules/local-windows-rdp/README.md index 67dca415b..bd7948fb5 100644 --- a/registry/coder/modules/local-windows-rdp/README.md +++ b/registry/coder/modules/local-windows-rdp/README.md @@ -11,7 +11,7 @@ tags: [rdp, windows, desktop, remote] # Windows RDP Desktop -This module enables Remote Desktop Protocol (RDP) on Windows workspaces and adds a one-click button to launch RDP sessions directly through Coder Desktop. It provides a complete, standalone solution for RDP access without requiring manual configuration or port forwarding. +This module enables Remote Desktop Protocol (RDP) on Windows workspaces and adds a one-click button to launch RDP sessions directly through [Coder Desktop](https://coder.com/docs/user-guides/desktop). It provides a complete, standalone solution for RDP access, eliminating the need for manual configuration or port forwarding through the Coder CLI. ```tf module "rdp_desktop" { From f24bfa21c37c4ba0d1fd85b8364f8140a2ece376 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 20 Jun 2025 18:58:08 +0000 Subject: [PATCH 18/18] chore(README): add note about Coder Desktop requirement for Local Windows RDP module and remove coder desktop requirement from frontmatter --- registry/coder/modules/local-windows-rdp/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/registry/coder/modules/local-windows-rdp/README.md b/registry/coder/modules/local-windows-rdp/README.md index bd7948fb5..4b447967f 100644 --- a/registry/coder/modules/local-windows-rdp/README.md +++ b/registry/coder/modules/local-windows-rdp/README.md @@ -4,7 +4,6 @@ description: Enable RDP on Windows and add a one-click Coder Desktop button for icon: ../../../../.icons/desktop.svg maintainer_github: coder verified: true -coder_desktop: true supported_os: [windows] tags: [rdp, windows, desktop, remote] --- @@ -13,6 +12,8 @@ tags: [rdp, windows, desktop, remote] This module enables Remote Desktop Protocol (RDP) on Windows workspaces and adds a one-click button to launch RDP sessions directly through [Coder Desktop](https://coder.com/docs/user-guides/desktop). It provides a complete, standalone solution for RDP access, eliminating the need for manual configuration or port forwarding through the Coder CLI. +> **Note**: [Coder Desktop](https://coder.com/docs/user-guides/desktop) is required on client devices to use the Local Windows RDP access feature. + ```tf module "rdp_desktop" { count = data.coder_workspace.me.start_count