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 "resource_id" { type = string description = "The ID of the primary Coder resource (e.g. VM)." } variable "admin_username" { type = string default = "Administrator" } variable "admin_password" { type = string default = "coderRDP!" sensitive = true } resource "coder_script" "windows-rdp" { agent_id = var.agent_id display_name = "windows-rdp" icon = "https://svgur.com/i/158F.svg" # TODO: add to Coder icons script = <', "$patch") | Set-Content $devolutionsHtml } } Set-AdminPassword -adminPassword "${var.admin_password}" Configure-RDP Install-DevolutionsGateway Patch-Devolutions-HTML EOF run_on_start = true } resource "coder_app" "windows-rdp" { agent_id = var.agent_id slug = "web-rdp" display_name = "Web RDP" url = "http://localhost:7171" icon = "https://svgur.com/i/158F.svg" subdomain = true healthcheck { url = "http://localhost:7171" interval = 5 threshold = 15 } } resource "coder_app" "rdp-docs" { agent_id = var.agent_id display_name = "Local RDP" slug = "rdp-docs" icon = "https://raw.githubusercontent.com/matifali/logos/main/windows.svg" url = "https://coder.com/docs/v2/latest/ides/remote-desktops#rdp-desktop" external = true } # For some reason this is not rendering, commented out for now # resource "coder_metadata" "rdp_details" { # resource_id = var.resource_id # daily_cost = 0 # item { # key = "Host" # value = "localhost" # } # item { # key = "Port" # value = "3389" # } # item { # key = "Username" # value = "Administrator" # } # item { # key = "Password" # value = var.admin_password # sensitive = true # } # }