Skip to content

Commit 7e52b80

Browse files
committed
simplification
1 parent 1656b33 commit 7e52b80

File tree

3 files changed

+6
-54
lines changed

3 files changed

+6
-54
lines changed

registry/coder/modules/jetbrains-gateway/README.md

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -43,43 +43,6 @@ module "jetbrains_gateway" {
4343
}
4444
```
4545

46-
### Embed the agent name in the Gateway URL
47-
48-
This can be used when support for connecting to multiple agents within one workspace is required.
49-
50-
To utilise this both `embed_agent_name` and `agent_name` must be populated on each instance of the module.
51-
In addition each instance must have a unique `slug` and `ide_parameter_name` variable defined.
52-
53-
```tf
54-
module "jetbrains_gateway" {
55-
count = data.coder_workspace.me.start_count
56-
source = "registry.coder.com/coder/jetbrains-gateway/coder"
57-
version = "1.2.3"
58-
agent_id = coder_agent.example.id
59-
folder = "/home/coder/example"
60-
jetbrains_ides = ["CL", "GO"]
61-
default = "GO"
62-
embed_agent_name = true
63-
agent_name = "main"
64-
ide_parameter_name = "jetbrains_ide" # default variable value
65-
slug = "gateway" # default variable value
66-
}
67-
68-
module "jetbrains_gateway_agent2" {
69-
count = data.coder_workspace.me.start_count
70-
source = "registry.coder.com/coder/jetbrains-gateway/coder"
71-
version = "1.2.3"
72-
agent_id = coder_agent.jetbrainsagent2.id
73-
folder = "/home/coder/example"
74-
jetbrains_ides = ["CL", "GO", "IU", "PY", "WS"]
75-
default = "GO"
76-
embed_agent_name = true
77-
agent_name = "jetbrainsagent2"
78-
ide_parameter_name = "jetbrains_ide_agent2"
79-
slug = "gateway-agent2"
80-
}
81-
```
82-
8346
### Use the latest version of each IDE
8447

8548
```tf

registry/coder/modules/jetbrains-gateway/main.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe("jetbrains-gateway", async () => {
2020
folder: "/home/coder",
2121
});
2222
expect(state.outputs.url.value).toBe(
23-
"jetbrains-gateway://connect#type=coder&workspace=default&owner=default&folder=/home/coder&url=https://mydeployment.coder.com&token=$SESSION_TOKEN&ide_product_code=IU&ide_build_number=243.21565.193&ide_download_link=https://download.jetbrains.com/idea/ideaIU-2024.3.tar.gz",
23+
"jetbrains-gateway://connect#type=coder&workspace=default&owner=default&folder=/home/coder&url=https://mydeployment.coder.com&token=$SESSION_TOKEN&ide_product_code=IU&ide_build_number=243.21565.193&ide_download_link=https://download.jetbrains.com/idea/ideaIU-2024.3.tar.gz&agent_id=foo",
2424
);
2525

2626
const coder_app = state.resources.find(
@@ -41,12 +41,11 @@ describe("jetbrains-gateway", async () => {
4141
expect(state.outputs.identifier.value).toBe("IU");
4242
});
4343

44-
it("optionally includes agent when embed_agent_name is true", async () => {
44+
it("optionally includes agent when an agent name is provided", async () => {
4545
const state = await runTerraformApply(import.meta.dir, {
4646
agent_id: "foo",
4747
agent_name: "main",
4848
folder: "/home/coder",
49-
embed_agent_name: true,
5049
});
5150

5251
expect(state.outputs.url.value).toBe(

registry/coder/modules/jetbrains-gateway/main.tf

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,6 @@ variable "group" {
6767
default = null
6868
}
6969

70-
variable "embed_agent_name" {
71-
type = bool
72-
description = "Embed the agent name in the JetBrains Gateway URL when support for multiple agents is required."
73-
default = false
74-
}
75-
76-
variable "ide_parameter_name" {
77-
type = string
78-
description = "Terraform parameter name for the JetBrains IDE selector. Must be unique per module instance."
79-
default = "jetbrains_ide"
80-
}
81-
8270
variable "coder_parameter_order" {
8371
type = number
8472
description = "The order determines the position of a template parameter in the UI/CLI presentation. The lowest order is shown first and parameters with equal order are sorted by name (ascending order)."
@@ -314,7 +302,7 @@ locals {
314302

315303
data "coder_parameter" "jetbrains_ide" {
316304
type = "string"
317-
name = var.ide_parameter_name
305+
name = "jetbrains_ide"
318306
display_name = "JetBrains IDE"
319307
icon = "/icon/gateway.svg"
320308
mutable = true
@@ -359,7 +347,9 @@ resource "coder_app" "gateway" {
359347
local.build_number,
360348
"&ide_download_link=",
361349
local.download_link,
362-
], var.embed_agent_name && trimspace(var.agent_name) != "" ? ["&agent=", var.agent_name] : []))
350+
], trimspace(var.agent_name) != ""
351+
? ["&agent=", var.agent_name]
352+
: (trimspace(var.agent_id) != "" ? ["&agent_id=", var.agent_id] : [])))
363353
}
364354

365355
output "identifier" {

0 commit comments

Comments
 (0)