File tree Expand file tree Collapse file tree 2 files changed +29
-4
lines changed
registry/coder/modules/jetbrains Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -300,7 +300,27 @@ describe("jetbrains", async () => {
300
300
expect ( url ) . toContain ( "&token=$SESSION_TOKEN" ) ;
301
301
expect ( url ) . toContain ( "&ide_product_code=GO" ) ;
302
302
expect ( url ) . toContain ( "&ide_build_number=" ) ;
303
- expect ( url ) . toContain ( "&agent_id=test-agent-123" ) ;
303
+ // No agent_name parameter should be included when agent_name is not specified
304
+ expect ( url ) . not . toContain ( "&agent_name=" ) ;
305
+ } ) ;
306
+
307
+ it ( "should include agent_name parameter when agent_name is specified" , async ( ) => {
308
+ const state = await runTerraformApply ( import . meta. dir , {
309
+ agent_id : "test-agent-123" ,
310
+ agent_name : "main-agent" ,
311
+ folder : "/custom/project/path" ,
312
+ default : '["GO"]' ,
313
+ } ) ;
314
+
315
+ const coder_app = state . resources . find (
316
+ ( res ) => res . type === "coder_app" && res . name === "jetbrains" ,
317
+ ) ;
318
+ const url = coder_app ?. instances [ 0 ] . attributes . url ;
319
+
320
+ expect ( url ) . toContain ( "jetbrains://gateway/coder" ) ;
321
+ expect ( url ) . toContain ( "&agent_name=main-agent" ) ;
322
+ expect ( url ) . toContain ( "&ide_product_code=GO" ) ;
323
+ expect ( url ) . toContain ( "&ide_build_number=" ) ;
304
324
} ) ;
305
325
306
326
it ( "should include build numbers from API in URLs" , async ( ) => {
Original file line number Diff line number Diff line change @@ -15,7 +15,13 @@ terraform {
15
15
16
16
variable "agent_id" {
17
17
type = string
18
- description = " The ID of a Coder agent."
18
+ description = " The resource ID of a Coder agent."
19
+ }
20
+
21
+ variable "agent_name" {
22
+ type = string
23
+ description = " The name of a Coder agent. Needed for workspaces with multiple agents."
24
+ default = null
19
25
}
20
26
21
27
variable "folder" {
@@ -239,7 +245,6 @@ resource "coder_app" "jetbrains" {
239
245
each . key ,
240
246
" &ide_build_number=" ,
241
247
local . options_metadata [each . key ]. build ,
242
- " &agent_id=" ,
243
- var . agent_id ,
248
+ var . agent_name != null ? " &agent_name=${ var . agent_name } " : " " ,
244
249
])
245
250
}
You can’t perform that action at this time.
0 commit comments