File tree Expand file tree Collapse file tree 3 files changed +75
-0
lines changed Expand file tree Collapse file tree 3 files changed +75
-0
lines changed Original file line number Diff line number Diff line change
1
+ terraform {
2
+ required_providers {
3
+ coder = {
4
+ source = " coder/coder"
5
+ }
6
+ local = {
7
+ source = " hashicorp/local"
8
+ }
9
+ }
10
+ }
11
+
12
+ data "coder_workspace" "me" {}
13
+
14
+ resource "coder_agent" "dev" {
15
+ os = " linux"
16
+ arch = " amd64"
17
+ dir = " /workspace"
18
+ }
19
+
20
+ resource "coder_app" "ai_interface" {
21
+ agent_id = coder_agent. dev . id
22
+ slug = " ai-chat"
23
+ share = " owner"
24
+ url = " http://localhost:8080"
25
+ }
26
+
27
+ data "coder_parameter" "ai_prompt" {
28
+ type = " string"
29
+ name = " AI Prompt"
30
+ default = " "
31
+ description = " Write a prompt for Claude Code"
32
+ mutable = true
33
+ }
34
+
35
+ resource "coder_ai_task" "task" {
36
+ sidebar_app {
37
+ id = coder_app. ai_interface . id
38
+ }
39
+ }
40
+
41
+ locals {
42
+ # NOTE: these must all be strings in the output
43
+ output = {
44
+ " ai_task.id" = coder_ai_task.task.id
45
+ " ai_task.app_id" = coder_ai_task.task.app_id
46
+ " ai_task.prompt" = coder_ai_task.task.prompt
47
+ " app.id" = coder_app.ai_interface.id
48
+ }
49
+ }
50
+
51
+ variable "output_path" {
52
+ type = string
53
+ }
54
+
55
+ resource "local_file" "output" {
56
+ filename = var. output_path
57
+ content = jsonencode (local. output )
58
+ }
59
+
60
+ output "output" {
61
+ value = local. output
62
+ sensitive = true
63
+ }
Original file line number Diff line number Diff line change
1
+ AI Prompt : " some prompt"
Original file line number Diff line number Diff line change @@ -211,13 +211,24 @@ func TestIntegration(t *testing.T) {
211
211
"coder_app.defaulted.hidden" : "false" ,
212
212
},
213
213
},
214
+ {
215
+ name : "coder-ai-task" ,
216
+ minVersion : "v2.26.0" ,
217
+ expectedOutput : map [string ]string {
218
+ "ai_task.id" : `^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$` ,
219
+ "ai_task.prompt" : "default" ,
220
+ "ai_task.app_id" : `^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$` ,
221
+ "app.id" : `^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$` ,
222
+ },
223
+ },
214
224
} {
215
225
tt := tt
216
226
t .Run (tt .name , func (t * testing.T ) {
217
227
t .Parallel ()
218
228
if coderVersion != "latest" && semver .Compare (coderVersion , tt .minVersion ) < 0 {
219
229
t .Skipf ("skipping due to CODER_VERSION %q < minVersion %q" , coderVersion , tt .minVersion )
220
230
}
231
+
221
232
// Given: we have an existing Coder deployment running locally
222
233
// Import named template
223
234
You can’t perform that action at this time.
0 commit comments