File tree Expand file tree Collapse file tree 4 files changed +9
-6
lines changed Expand file tree Collapse file tree 4 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ Use this resource to define Coder tasks.
2222
2323### Read-Only
2424
25+ - ` enabled ` (Boolean) The field is true if the template is being provisioned as a task.
2526- ` id ` (String) A unique identifier for this resource.
2627- ` prompt ` (String) The prompt text provided to the task by Coder.
2728
Original file line number Diff line number Diff line change @@ -41,10 +41,11 @@ resource "coder_ai_task" "task" {
4141locals {
4242 # NOTE: these must all be strings in the output
4343 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
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+ " ai_task.enabled" = tostring (coder_ai_task. task . enabled )
48+ " app.id" = coder_app.ai_interface.id
4849 }
4950}
5051
Original file line number Diff line number Diff line change @@ -219,6 +219,7 @@ func TestIntegration(t *testing.T) {
219219 "ai_task.prompt" : "" ,
220220 "ai_task.app_id" : `^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$` ,
221221 "app.id" : `^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$` ,
222+ "ai_task.enabled" : strconv .FormatBool (os .Getenv ("CODER_TASK_ID" ) != "" ),
222223 },
223224 },
224225 } {
Original file line number Diff line number Diff line change @@ -32,8 +32,8 @@ func aiTaskResource() *schema.Resource {
3232 CreateContext : func (c context.Context , resourceData * schema.ResourceData , i any ) diag.Diagnostics {
3333 var diags diag.Diagnostics
3434
35- if idStr := os .Getenv ("CODER_TASK_ID" ); idStr != "" {
36- resourceData .SetId (idStr )
35+ if id , err := uuid . Parse ( os .Getenv ("CODER_TASK_ID" )); err == nil && id != uuid . Nil {
36+ resourceData .SetId (id . String () )
3737 resourceData .Set ("enabled" , true )
3838 } else {
3939 resourceData .SetId (uuid .NewString ())
You can’t perform that action at this time.
0 commit comments