From 8ba4c323c26f876b936e37dd6a9e0387b5ec9a68 Mon Sep 17 00:00:00 2001 From: Hugo Dutka Date: Sat, 2 Aug 2025 16:21:13 +0200 Subject: [PATCH] fix(claude-code): workaround for a coder bug (#283) Workaround to address https://github.com/coder/coder/issues/18776 --- registry/coder/modules/claude-code/README.md | 6 +++--- registry/coder/modules/claude-code/main.tf | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/registry/coder/modules/claude-code/README.md b/registry/coder/modules/claude-code/README.md index 97f7d97a..4771f6b8 100644 --- a/registry/coder/modules/claude-code/README.md +++ b/registry/coder/modules/claude-code/README.md @@ -13,7 +13,7 @@ Run the [Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude ```tf module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "2.0.4" + version = "2.0.5" agent_id = coder_agent.example.id folder = "/home/coder" install_claude_code = true @@ -84,7 +84,7 @@ resource "coder_agent" "main" { module "claude-code" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/claude-code/coder" - version = "2.0.4" + version = "2.0.5" agent_id = coder_agent.example.id folder = "/home/coder" install_claude_code = true @@ -102,7 +102,7 @@ Run Claude Code as a standalone app in your workspace. This will install Claude ```tf module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "2.0.4" + version = "2.0.5" agent_id = coder_agent.example.id folder = "/home/coder" install_claude_code = true diff --git a/registry/coder/modules/claude-code/main.tf b/registry/coder/modules/claude-code/main.tf index d8d4b9b5..b5dfc7c8 100644 --- a/registry/coder/modules/claude-code/main.tf +++ b/registry/coder/modules/claude-code/main.tf @@ -289,3 +289,11 @@ resource "coder_ai_task" "claude_code" { id = coder_app.claude_code_web.id } } + +# As of https://github.com/coder/coder/commit/6ba4b5bbc95e2e528d7f5b1e31fffa200ae1a6db, +# there's a bug in Coder's Terraform statefile parsing which prevents it from seeing coder_apps +# in certain scenarios. This is a workaround to bypass this bug until we have a proper fix. +# For more details see https://github.com/coder/coder/issues/18776 +resource "terraform_data" "claude_code_app_id" { + input = coder_app.claude_code_web.id +}