Files
registry/registry/cytoshahar/modules/positron/main.tf
T
Shahar Zrihen 6acded53f6 added positron desktop ide module based on vs code desktop (#528)
Co-authored-by: DevCats <chris@dualriver.com>
Co-authored-by: Atif Ali <atif@coder.com>
2025-11-23 09:19:09 +00:00

75 lines
1.7 KiB
Terraform

terraform {
required_version = ">= 1.0"
required_providers {
coder = {
source = "coder/coder"
version = ">= 2.5"
}
}
}
locals {
icon_url = "/icon/positron.svg"
}
variable "agent_id" {
type = string
description = "The ID of a Coder agent."
}
variable "folder" {
type = string
description = "The folder to open in Positron."
default = ""
}
variable "open_recent" {
type = bool
description = "Open the most recent workspace or folder. Falls back to the folder if there is no recent workspace or folder to open."
default = false
}
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
}
variable "group" {
type = string
description = "The name of a group that this app belongs to."
default = null
}
data "coder_workspace" "me" {}
data "coder_workspace_owner" "me" {}
resource "coder_app" "positron" {
agent_id = var.agent_id
external = true
icon = local.icon_url
slug = "positron"
display_name = "Positron Desktop"
order = var.order
group = var.group
url = join("", [
"positron://coder.coder-remote/open",
"?owner=",
data.coder_workspace_owner.me.name,
"&workspace=",
data.coder_workspace.me.name,
var.folder != "" ? join("", ["&folder=", var.folder]) : "",
var.open_recent ? "&openRecent" : "",
"&url=",
data.coder_workspace.me.access_url,
"&token=$SESSION_TOKEN",
])
}
output "positron_url" {
value = coder_app.positron.url
description = "Positron Desktop URL."
}