Compare commits
6 Commits
v1.0.27
...
atif/jetbr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
271c0bf6c1 | ||
|
|
734f4a7009 | ||
|
|
b57d7f170c | ||
|
|
630a92966c | ||
|
|
309c7eb24b | ||
|
|
ef10dcfc67 |
@@ -14,12 +14,12 @@ This module adds a JetBrains Gateway Button to open any workspace with a single
|
|||||||
```tf
|
```tf
|
||||||
module "jetbrains_gateway" {
|
module "jetbrains_gateway" {
|
||||||
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.24"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
agent_name = "example"
|
agent_name = "example"
|
||||||
folder = "/home/coder/example"
|
folder = "/home/coder/example"
|
||||||
jetbrains_ides = ["CL", "GO", "IU", "PY", "WS"]
|
jetbrains_ides = ["CL", "GO", "IU", "PY", "WS"]
|
||||||
default = "GO"
|
default = ["GO"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -32,12 +32,12 @@ module "jetbrains_gateway" {
|
|||||||
```tf
|
```tf
|
||||||
module "jetbrains_gateway" {
|
module "jetbrains_gateway" {
|
||||||
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.24"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
agent_name = "example"
|
agent_name = "example"
|
||||||
folder = "/home/coder/example"
|
folder = "/home/coder/example"
|
||||||
jetbrains_ides = ["GO", "WS"]
|
jetbrains_ides = ["GO", "WS"]
|
||||||
default = "GO"
|
default = ["GO"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -46,12 +46,12 @@ module "jetbrains_gateway" {
|
|||||||
```tf
|
```tf
|
||||||
module "jetbrains_gateway" {
|
module "jetbrains_gateway" {
|
||||||
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.24"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
agent_name = "example"
|
agent_name = "example"
|
||||||
folder = "/home/coder/example"
|
folder = "/home/coder/example"
|
||||||
jetbrains_ides = ["GO", "WS"]
|
jetbrains_ides = ["GO", "WS"]
|
||||||
default = "GO"
|
default = ["GO"]
|
||||||
latest = true
|
latest = true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -61,32 +61,46 @@ module "jetbrains_gateway" {
|
|||||||
```tf
|
```tf
|
||||||
module "jetbrains_gateway" {
|
module "jetbrains_gateway" {
|
||||||
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.24"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
agent_name = "example"
|
agent_name = "example"
|
||||||
folder = "/home/coder/example"
|
folder = "/home/coder/example"
|
||||||
jetbrains_ides = ["GO", "WS"]
|
jetbrains_ides = ["GO", "WS"]
|
||||||
default = "GO"
|
default = ["GO"]
|
||||||
latest = true
|
latest = true
|
||||||
channel = "eap"
|
channel = "eap"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Custom base link
|
### Add Multiple IDEs with the default set to GoLand
|
||||||
|
|
||||||
|
```tf
|
||||||
|
module "jetbrains_gateway" {
|
||||||
|
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
||||||
|
version = "1.0.24"
|
||||||
|
agent_id = coder_agent.example.id
|
||||||
|
agent_name = "example"
|
||||||
|
folder = "/home/coder/example"
|
||||||
|
jetbrains_ides = ["GO", "WS", "RD", "PY"]
|
||||||
|
default = ["GO", "PY"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Custom release download link
|
||||||
|
|
||||||
Due to the highest priority of the `ide_download_link` parameter in the `(jetbrains-gateway://...` within IDEA, the pre-configured download address will be overridden when using [IDEA's offline mode](https://www.jetbrains.com/help/idea/fully-offline-mode.html). Therefore, it is necessary to configure the `download_base_link` parameter for the `jetbrains_gateway` module to change the value of `ide_download_link`.
|
Due to the highest priority of the `ide_download_link` parameter in the `(jetbrains-gateway://...` within IDEA, the pre-configured download address will be overridden when using [IDEA's offline mode](https://www.jetbrains.com/help/idea/fully-offline-mode.html). Therefore, it is necessary to configure the `download_base_link` parameter for the `jetbrains_gateway` module to change the value of `ide_download_link`.
|
||||||
|
|
||||||
```tf
|
```tf
|
||||||
module "jetbrains_gateway" {
|
module "jetbrains_gateway" {
|
||||||
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.24"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
agent_name = "example"
|
agent_name = "example"
|
||||||
folder = "/home/coder/example"
|
folder = "/home/coder/example"
|
||||||
jetbrains_ides = ["GO", "WS"]
|
jetbrains_ides = ["GO", "WS"]
|
||||||
releases_base_link = "https://releases.internal.site/"
|
releases_base_link = "https://releases.internal.site/"
|
||||||
download_base_link = "https://download.internal.site/"
|
download_base_link = "https://download.internal.site/"
|
||||||
default = "GO"
|
default = ["GO"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ variable "agent_id" {
|
|||||||
|
|
||||||
variable "slug" {
|
variable "slug" {
|
||||||
type = string
|
type = string
|
||||||
description = "The slug for the coder_app. Allows resuing the module with the same template."
|
description = "The slug for the coder_app"
|
||||||
default = "gateway"
|
default = "gateway"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,9 +39,9 @@ variable "folder" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "default" {
|
variable "default" {
|
||||||
default = ""
|
default = []
|
||||||
type = string
|
type = list(string)
|
||||||
description = "Default IDE"
|
description = "Default IDEs to be added to the Workspace page."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "order" {
|
variable "order" {
|
||||||
@@ -166,6 +166,12 @@ variable "download_base_link" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "provide_options" {
|
||||||
|
type = bool
|
||||||
|
description = "Whether to provide coder_parameter options."
|
||||||
|
default = true
|
||||||
|
}
|
||||||
|
|
||||||
data "http" "jetbrains_ide_versions" {
|
data "http" "jetbrains_ide_versions" {
|
||||||
for_each = var.latest ? toset(var.jetbrains_ides) : toset([])
|
for_each = var.latest ? toset(var.jetbrains_ides) : toset([])
|
||||||
url = "${var.releases_base_link}/products/releases?code=${each.key}&latest=true&type=${var.channel}"
|
url = "${var.releases_base_link}/products/releases?code=${each.key}&latest=true&type=${var.channel}"
|
||||||
@@ -239,23 +245,19 @@ locals {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
icon = local.jetbrains_ides[data.coder_parameter.jetbrains_ide.value].icon
|
default_ide_map = {
|
||||||
json_data = var.latest ? jsondecode(data.http.jetbrains_ide_versions[data.coder_parameter.jetbrains_ide.value].response_body) : {}
|
for ide in var.default : ide => local.jetbrains_ides[ide]
|
||||||
key = var.latest ? keys(local.json_data)[0] : ""
|
}
|
||||||
display_name = local.jetbrains_ides[data.coder_parameter.jetbrains_ide.value].name
|
|
||||||
identifier = data.coder_parameter.jetbrains_ide.value
|
|
||||||
download_link = var.latest ? local.json_data[local.key][0].downloads.linux.link : local.jetbrains_ides[data.coder_parameter.jetbrains_ide.value].download_link
|
|
||||||
build_number = var.latest ? local.json_data[local.key][0].build : local.jetbrains_ides[data.coder_parameter.jetbrains_ide.value].build_number
|
|
||||||
version = var.latest ? local.json_data[local.key][0].version : var.jetbrains_ide_versions[data.coder_parameter.jetbrains_ide.value].version
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data "coder_parameter" "jetbrains_ide" {
|
data "coder_parameter" "jetbrains_ide" {
|
||||||
|
for_each = local.default_ide_map
|
||||||
type = "string"
|
type = "string"
|
||||||
name = "jetbrains_ide"
|
name = "jetbrains_ide_${each.key}"
|
||||||
display_name = "JetBrains IDE"
|
display_name = "JetBrains IDE ${each.key}"
|
||||||
icon = "/icon/gateway.svg"
|
icon = "/icon/gateway.svg"
|
||||||
mutable = true
|
mutable = true
|
||||||
default = var.default == "" ? var.jetbrains_ides[0] : var.default
|
default = each.key
|
||||||
order = var.coder_parameter_order
|
order = var.coder_parameter_order
|
||||||
|
|
||||||
dynamic "option" {
|
dynamic "option" {
|
||||||
@@ -272,10 +274,11 @@ data "coder_workspace" "me" {}
|
|||||||
data "coder_workspace_owner" "me" {}
|
data "coder_workspace_owner" "me" {}
|
||||||
|
|
||||||
resource "coder_app" "gateway" {
|
resource "coder_app" "gateway" {
|
||||||
|
for_each = local.default_ide_map
|
||||||
agent_id = var.agent_id
|
agent_id = var.agent_id
|
||||||
slug = var.slug
|
slug = "${var.slug}-${lower(each.key)}"
|
||||||
display_name = local.display_name
|
display_name = each.value.name
|
||||||
icon = local.icon
|
icon = each.value.icon
|
||||||
external = true
|
external = true
|
||||||
order = var.order
|
order = var.order
|
||||||
url = join("", [
|
url = join("", [
|
||||||
@@ -292,38 +295,23 @@ resource "coder_app" "gateway" {
|
|||||||
"&token=",
|
"&token=",
|
||||||
"$SESSION_TOKEN",
|
"$SESSION_TOKEN",
|
||||||
"&ide_product_code=",
|
"&ide_product_code=",
|
||||||
data.coder_parameter.jetbrains_ide.value,
|
each.key,
|
||||||
"&ide_build_number=",
|
"&ide_build_number=",
|
||||||
local.build_number,
|
each.value.build_number,
|
||||||
"&ide_download_link=",
|
"&ide_download_link=",
|
||||||
local.download_link,
|
each.value.download_link,
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
output "identifier" {
|
output "coder_apps" {
|
||||||
value = local.identifier
|
value = {
|
||||||
}
|
for key, app in coder_app.gateway : key => {
|
||||||
|
identifier = key
|
||||||
output "display_name" {
|
display_name = app.display_name
|
||||||
value = local.display_name
|
icon = local.jetbrains_ides[key].icon
|
||||||
}
|
download_link = local.jetbrains_ides[key].download_link
|
||||||
|
build_number = local.jetbrains_ides[key].build_number
|
||||||
output "icon" {
|
version = local.jetbrains_ides[key].version
|
||||||
value = local.icon
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
output "download_link" {
|
|
||||||
value = local.download_link
|
|
||||||
}
|
|
||||||
|
|
||||||
output "build_number" {
|
|
||||||
value = local.build_number
|
|
||||||
}
|
|
||||||
|
|
||||||
output "version" {
|
|
||||||
value = local.version
|
|
||||||
}
|
|
||||||
|
|
||||||
output "url" {
|
|
||||||
value = coder_app.gateway.url
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user