Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

docs: update Tasks Template Code#19770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
david-fraley merged 6 commits intomainfromdavid-fraley/update-tasks-template-code
Sep 16, 2025
Merged
Changes fromall 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
49 changes: 39 additions & 10 deletionsdocs/ai-coder/tasks.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -46,24 +46,53 @@ To import the template and begin configuring it, follow the [documentation in th

### Option 2) Create or Duplicate Your Own Template

A template becomes a Task template if it defines a `coder_ai_task` resource and a `coder_parameter` named `"AI Prompt"`. Coder analyzes template files during template version import to determine if these requirements are met.
A template becomes a Task template if it defines a `coder_ai_task` resource and a `coder_parameter` named `"AI Prompt"`. Coder analyzes template files during template version import to determine if these requirements are met. Try adding this terraform block to an existing template where you'll add our Claude Code module. Note: the `coder_ai_task` resource is defined within the [Claude Code Module](https://registry.coder.com/modules/coder/claude-code?tab=readme), so it's not defined within this block.

```hcl
data "coder_parameter" "ai_prompt" {
name = "AI Prompt"
type = "string"
}

# Multiple coder_ai_tasks can be defined in a template
resource "coder_ai_task" "claude-code" {
# At most one coder ai task can be instantiated during a workspace build.
# Coder fails the build if it would instantiate more than 1.
count = data.coder_parameter.ai_prompt.value != "" ? 1 : 0
data "coder_parameter" "setup_script" {
name = "setup_script"
display_name = "Setup Script"
type = "string"
form_type = "textarea"
description = "Script to run before running the agent"
mutable = false
default = ""
}

# The Claude Code module does the automatic task reporting
# Other agent modules: https://registry.coder.com/modules?search=agent
# Or use a custom agent:
module "claude-code" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/claude-code/coder"
version = "2.2.0"
agent_id = coder_agent.main.id
folder = "/home/coder/projects"
install_claude_code = true
claude_code_version = "latest"
order = 999

# experiment_post_install_script = data.coder_parameter.setup_script.value

# This enables Coder Tasks
experiment_report_tasks = true
}

variable "anthropic_api_key" {
type = string
description = "Generate one at: https://console.anthropic.com/settings/keys"
sensitive = true
}

sidebar_app {
# which app to display in the sidebar on the task page
id = coder_app.claude-code.id
}
resource "coder_env" "anthropic_api_key" {
agent_id = coder_agent.main.id
name= "CODER_MCP_CLAUDE_API_KEY"
value = var.anthropic_api_key
}
```

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp