Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions docs/data-sources/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
```

Expand All @@ -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.
11 changes: 7 additions & 4 deletions docs/resources/ai_task.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,32 @@ 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).



<!-- schema generated by tfplugindocs -->
## Schema

### 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))
Comment thread
matifali marked this conversation as resolved.

### 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.

Expand All @@ -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.
2 changes: 1 addition & 1 deletion examples/data-sources/coder_task/data-source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
35 changes: 32 additions & 3 deletions provider/ai_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,47 @@ 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"`
Prompt string `mapstructure:"prompt"`
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

Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
},
},
Expand All @@ -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{}

Expand All @@ -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.",
},
},
Expand Down
Loading