diff --git a/docs/data-sources/task.md b/docs/data-sources/task.md index 43396eae..cdae7a27 100644 --- a/docs/data-sources/task.md +++ b/docs/data-sources/task.md @@ -4,12 +4,15 @@ page_title: "coder_task Data Source - terraform-provider-coder" subcategory: "" description: |- Use this data source to read information about Coder Tasks. + ~> Deprecated: Coder Tasks is deprecated as of Coder v2.34 and will be removed in a future release. Starting June 2, 2026, Coder Tasks moves to a 12-month Extended Support Release (ESR) for Premium customers. Templates no longer require AI task resources; use Coder Agents https://coder.com/docs/ai-coder/agents and follow the migration guide https://coder.com/docs/ai-coder/agents/tasks-to-chats-migration. Coder Tasks documentation remains available in the v2.36 documentation https://coder.com/docs/@v2.36.3/ai-coder/tasks. --- # coder_task (Data Source) Use this data source to read information about Coder Tasks. +~> **Deprecated**: Coder Tasks is deprecated as of Coder v2.34 and will be removed in a future release. Starting June 2, 2026, Coder Tasks moves to a 12-month Extended Support Release (ESR) for Premium customers. Templates no longer require AI task resources; use [Coder Agents](https://coder.com/docs/ai-coder/agents) and follow the [migration guide](https://coder.com/docs/ai-coder/agents/tasks-to-chats-migration). Coder Tasks documentation remains available in the [v2.36 documentation](https://coder.com/docs/@v2.36.3/ai-coder/tasks). + ## Example Usage ```terraform @@ -25,7 +28,7 @@ resource "coder_ai_task" "task" { module "example-agent" { count = data.coder_task.me.enabled ? data.coder_workspace.me.start_count : 0 - prompt = data.coder_ai_task.me.prompt + prompt = data.coder_task.me.prompt } ``` @@ -34,10 +37,10 @@ module "example-agent" { ### Read-Only -- `enabled` (Boolean) True when executing in a Coder Task context, false when in a Coder Workspace context. +- `enabled` (Boolean, Deprecated) True when executing in a Coder Task context, false when in a Coder Workspace context. -> The `enabled` field is only populated in Coder v2.28 and later. - `id` (String) The UUID of the task, if executing in a Coder Task context. Empty in a Coder Workspace context. -- `prompt` (String) The prompt text provided to the task by Coder, if executing in a Coder Task context. Empty in a Coder Workspace context. +- `prompt` (String, Deprecated) The prompt text provided to the task by Coder, if executing in a Coder Task context. Empty in a Coder Workspace context. -> The `prompt` field is only populated in Coder v2.28 and later. diff --git a/docs/resources/ai_task.md b/docs/resources/ai_task.md index 3619c680..0a92ab0c 100644 --- a/docs/resources/ai_task.md +++ b/docs/resources/ai_task.md @@ -4,12 +4,15 @@ page_title: "coder_ai_task Resource - terraform-provider-coder" subcategory: "" description: |- Use this resource to define Coder tasks. + ~> Deprecated: Coder Tasks is deprecated as of Coder v2.34 and will be removed in a future release. Starting June 2, 2026, Coder Tasks moves to a 12-month Extended Support Release (ESR) for Premium customers. Templates no longer require AI task resources; use Coder Agents https://coder.com/docs/ai-coder/agents and follow the migration guide https://coder.com/docs/ai-coder/agents/tasks-to-chats-migration. Coder Tasks documentation remains available in the v2.36 documentation https://coder.com/docs/@v2.36.3/ai-coder/tasks. --- # coder_ai_task (Resource) Use this resource to define Coder tasks. +~> **Deprecated**: Coder Tasks is deprecated as of Coder v2.34 and will be removed in a future release. Starting June 2, 2026, Coder Tasks moves to a 12-month Extended Support Release (ESR) for Premium customers. Templates no longer require AI task resources; use [Coder Agents](https://coder.com/docs/ai-coder/agents) and follow the [migration guide](https://coder.com/docs/ai-coder/agents/tasks-to-chats-migration). Coder Tasks documentation remains available in the [v2.36 documentation](https://coder.com/docs/@v2.36.3/ai-coder/tasks). + @@ -17,16 +20,16 @@ Use this resource to define Coder tasks. ### Optional -- `app_id` (String) The ID of the `coder_app` resource that provides the AI interface for this task. +- `app_id` (String, **Deprecated**: Coder Tasks is deprecated as of Coder v2.34 and will be removed in a future release.) The ID of the `coder_app` resource that provides the AI interface for this task. - `sidebar_app` (Block Set, Max: 1, Deprecated) The coder_app to display in the sidebar. Usually a chat interface with the AI agent running in the workspace, like https://github.com/coder/agentapi. (see [below for nested schema](#nestedblock--sidebar_app)) ### Read-Only -- `enabled` (Boolean) True when executing in a Coder Task context, false when in a Coder Workspace context. +- `enabled` (Boolean, Deprecated) True when executing in a Coder Task context, false when in a Coder Workspace context. -> The `enabled` field is only populated in Coder v2.28 and later. - `id` (String) A unique identifier for this resource. -- `prompt` (String) The prompt text provided to the task by Coder. +- `prompt` (String, Deprecated) The prompt text provided to the task by Coder. -> The `prompt` field is only populated in Coder v2.28 and later. @@ -35,4 +38,4 @@ Use this resource to define Coder tasks. Required: -- `id` (String) A reference to an existing `coder_app` resource in your template. +- `id` (String, Deprecated) A reference to an existing `coder_app` resource in your template. diff --git a/examples/data-sources/coder_task/data-source.tf b/examples/data-sources/coder_task/data-source.tf index af2098e1..f7098f97 100644 --- a/examples/data-sources/coder_task/data-source.tf +++ b/examples/data-sources/coder_task/data-source.tf @@ -10,5 +10,5 @@ resource "coder_ai_task" "task" { module "example-agent" { count = data.coder_task.me.enabled ? data.coder_workspace.me.start_count : 0 - prompt = data.coder_ai_task.me.prompt + prompt = data.coder_task.me.prompt } diff --git a/provider/ai_task.go b/provider/ai_task.go index 1bb6cf65..86ed8905 100644 --- a/provider/ai_task.go +++ b/provider/ai_task.go @@ -10,6 +10,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) +// Deprecated: Coder Tasks is deprecated as of Coder v2.34 and will be removed in +// a future release. Use Coder Agents instead: +// https://coder.com/docs/ai-coder/agents/tasks-to-chats-migration type AITask struct { ID string `mapstructure:"id"` SidebarApp []AITaskSidebarApp `mapstructure:"sidebar_app"` @@ -17,18 +20,37 @@ type AITask struct { AppID string `mapstructure:"app_id"` } +// Deprecated: Coder Tasks is deprecated as of Coder v2.34 and will be removed in +// a future release. Use Coder Agents instead: +// https://coder.com/docs/ai-coder/agents/tasks-to-chats-migration type AITaskSidebarApp struct { ID string `mapstructure:"id"` } // TaskPromptParameterName is the name of the parameter which is *required* to be defined when a coder_ai_task is used. +// +// Deprecated: Coder Tasks is deprecated as of Coder v2.34. Task prompts are read +// from the task itself, not from a parameter. const TaskPromptParameterName = "AI Prompt" +// aiTaskDeprecationMessage is surfaced by Terraform whenever a deprecated AI +// task resource or data source is used. +const aiTaskDeprecationMessage = "Coder Tasks is deprecated as of Coder v2.34 and will be removed in a future release. Use Coder Agents instead: https://coder.com/docs/ai-coder/agents/tasks-to-chats-migration" + +// aiTaskAttributeDeprecationMessage is surfaced by Terraform whenever a +// deprecated AI task attribute is used. It is kept short because it is rendered +// inline in the generated attribute documentation. +const aiTaskAttributeDeprecationMessage = "Coder Tasks is deprecated as of Coder v2.34 and will be removed in a future release." + +// aiTaskDeprecationNotice is rendered in the generated documentation. +const aiTaskDeprecationNotice = "\n\n~> **Deprecated**: Coder Tasks is deprecated as of Coder v2.34 and will be removed in a future release. Starting June 2, 2026, Coder Tasks moves to a 12-month Extended Support Release (ESR) for Premium customers. Templates no longer require AI task resources; use [Coder Agents](https://coder.com/docs/ai-coder/agents) and follow the [migration guide](https://coder.com/docs/ai-coder/agents/tasks-to-chats-migration). Coder Tasks documentation remains available in the [v2.36 documentation](https://coder.com/docs/@v2.36.3/ai-coder/tasks)." + func aiTaskResource() *schema.Resource { return &schema.Resource{ SchemaVersion: 1, - Description: "Use this resource to define Coder tasks.", + DeprecationMessage: aiTaskDeprecationMessage, + Description: "Use this resource to define Coder tasks." + aiTaskDeprecationNotice, CreateContext: func(c context.Context, resourceData *schema.ResourceData, i any) diag.Diagnostics { var diags diag.Diagnostics @@ -76,7 +98,7 @@ func aiTaskResource() *schema.Resource { "sidebar_app": { Type: schema.TypeSet, Description: "The coder_app to display in the sidebar. Usually a chat interface with the AI agent running in the workspace, like https://github.com/coder/agentapi.", - Deprecated: "This field has been deprecated in favor of the `app_id` field.", + Deprecated: "This field has been deprecated in favor of the `app_id` field. " + aiTaskAttributeDeprecationMessage, ForceNew: true, Optional: true, MaxItems: 1, @@ -86,6 +108,7 @@ func aiTaskResource() *schema.Resource { "id": { Type: schema.TypeString, Description: "A reference to an existing `coder_app` resource in your template.", + Deprecated: aiTaskAttributeDeprecationMessage, Required: true, ForceNew: true, ValidateFunc: validation.IsUUID, @@ -96,11 +119,13 @@ func aiTaskResource() *schema.Resource { "prompt": { Type: schema.TypeString, Description: "The prompt text provided to the task by Coder.\n\n -> The `prompt` field is only populated in Coder v2.28 and later.", + Deprecated: aiTaskAttributeDeprecationMessage, Computed: true, }, "app_id": { Type: schema.TypeString, Description: "The ID of the `coder_app` resource that provides the AI interface for this task.", + Deprecated: aiTaskAttributeDeprecationMessage, ForceNew: true, Optional: true, Computed: true, @@ -110,6 +135,7 @@ func aiTaskResource() *schema.Resource { "enabled": { Type: schema.TypeBool, Description: "True when executing in a Coder Task context, false when in a Coder Workspace context.\n\n -> The `enabled` field is only populated in Coder v2.28 and later.", + Deprecated: aiTaskAttributeDeprecationMessage, Computed: true, }, }, @@ -118,7 +144,8 @@ func aiTaskResource() *schema.Resource { func taskDatasource() *schema.Resource { return &schema.Resource{ - Description: "Use this data source to read information about Coder Tasks.", + DeprecationMessage: aiTaskDeprecationMessage, + Description: "Use this data source to read information about Coder Tasks." + aiTaskDeprecationNotice, ReadContext: func(ctx context.Context, rd *schema.ResourceData, i interface{}) diag.Diagnostics { diags := diag.Diagnostics{} @@ -145,11 +172,13 @@ func taskDatasource() *schema.Resource { "prompt": { Type: schema.TypeString, Computed: true, + Deprecated: aiTaskAttributeDeprecationMessage, Description: "The prompt text provided to the task by Coder, if executing in a Coder Task context. Empty in a Coder Workspace context.\n\n -> The `prompt` field is only populated in Coder v2.28 and later.", }, "enabled": { Type: schema.TypeBool, Computed: true, + Deprecated: aiTaskAttributeDeprecationMessage, Description: "True when executing in a Coder Task context, false when in a Coder Workspace context.\n\n -> The `enabled` field is only populated in Coder v2.28 and later.", }, },