refactor(coder-labs/tasks-docker): support coder/claude-code 4.0.0 (#497)
Updates the template to use the new version of the claude-code module for the Coder 2.28 release. This closely matches the [built-in template](https://github.com/coder/coder/blob/main/examples/templates/tasks-docker/main.tf) defined in [coder/coder](https://github.com/coder/coder).
This commit is contained in:
parent
69abf48390
commit
4edfdae572
@ -2,6 +2,7 @@ terraform {
|
|||||||
required_providers {
|
required_providers {
|
||||||
coder = {
|
coder = {
|
||||||
source = "coder/coder"
|
source = "coder/coder"
|
||||||
|
version = ">= 2.13"
|
||||||
}
|
}
|
||||||
docker = {
|
docker = {
|
||||||
source = "kreuzwerker/docker"
|
source = "kreuzwerker/docker"
|
||||||
@ -16,18 +17,28 @@ terraform {
|
|||||||
# see: https://registry.coder.com/templates
|
# see: https://registry.coder.com/templates
|
||||||
provider "docker" {}
|
provider "docker" {}
|
||||||
|
|
||||||
|
# A `coder_ai_task` resource enables Tasks and associates
|
||||||
|
# the task with the coder_app that will act as an AI agent.
|
||||||
|
resource "coder_ai_task" "task" {
|
||||||
|
count = data.coder_workspace.me.start_count
|
||||||
|
app_id = module.claude-code[count.index].task_app_id
|
||||||
|
}
|
||||||
|
|
||||||
|
# You can read the task prompt from the `coder_task` data source.
|
||||||
|
data "coder_task" "me" {}
|
||||||
|
|
||||||
# The Claude Code module does the automatic task reporting
|
# The Claude Code module does the automatic task reporting
|
||||||
# Other agent modules: https://registry.coder.com/modules?search=agent
|
# Other agent modules: https://registry.coder.com/modules?search=agent
|
||||||
# Or use a custom agent:
|
# Or use a custom agent:
|
||||||
module "claude-code" {
|
module "claude-code" {
|
||||||
count = data.coder_workspace.me.start_count
|
count = data.coder_workspace.me.start_count
|
||||||
source = "registry.coder.com/coder/claude-code/coder"
|
source = "registry.coder.com/coder/claude-code/coder"
|
||||||
version = "3.0.0"
|
version = "4.0.0"
|
||||||
agent_id = coder_agent.main.id
|
agent_id = coder_agent.main.id
|
||||||
workdir = "/home/coder/projects"
|
workdir = "/home/coder/projects"
|
||||||
order = 999
|
order = 999
|
||||||
claude_api_key = ""
|
claude_api_key = ""
|
||||||
ai_prompt = data.coder_parameter.ai_prompt.value
|
ai_prompt = data.coder_task.me.prompt
|
||||||
system_prompt = data.coder_parameter.system_prompt.value
|
system_prompt = data.coder_parameter.system_prompt.value
|
||||||
model = "sonnet"
|
model = "sonnet"
|
||||||
permission_mode = "plan"
|
permission_mode = "plan"
|
||||||
@ -126,13 +137,6 @@ data "coder_parameter" "system_prompt" {
|
|||||||
description = "System prompt for the agent with generalized instructions"
|
description = "System prompt for the agent with generalized instructions"
|
||||||
mutable = false
|
mutable = false
|
||||||
}
|
}
|
||||||
data "coder_parameter" "ai_prompt" {
|
|
||||||
type = "string"
|
|
||||||
name = "AI Prompt"
|
|
||||||
default = ""
|
|
||||||
description = "Write a prompt for Claude Code"
|
|
||||||
mutable = true
|
|
||||||
}
|
|
||||||
data "coder_parameter" "setup_script" {
|
data "coder_parameter" "setup_script" {
|
||||||
name = "setup_script"
|
name = "setup_script"
|
||||||
display_name = "Setup Script"
|
display_name = "Setup Script"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user