From 571f9215059a2f9e408f365ba0d5ede0fec6e3d0 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Wed, 24 Sep 2025 19:52:59 -0500 Subject: [PATCH 1/3] docs: update Claude Code module to version 3.0.1 and add AWS Bedrock and Google Vertex AI usage examples --- registry/coder/modules/claude-code/README.md | 102 ++++++++++++++++++- 1 file changed, 98 insertions(+), 4 deletions(-) diff --git a/registry/coder/modules/claude-code/README.md b/registry/coder/modules/claude-code/README.md index 04d8f8c85..772f20b81 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 = "3.0.0" + version = "3.0.1" agent_id = coder_agent.example.id workdir = "/home/coder/project" claude_api_key = "xxxx-xxxxx-xxxx" @@ -49,7 +49,7 @@ data "coder_parameter" "ai_prompt" { module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "3.0.0" + version = "3.0.1" agent_id = coder_agent.example.id workdir = "/home/coder/project" @@ -85,7 +85,7 @@ Run and configure Claude Code as a standalone CLI in your workspace. ```tf module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "3.0.0" + version = "3.0.1" agent_id = coder_agent.example.id workdir = "/home/coder" install_claude_code = true @@ -108,13 +108,107 @@ variable "claude_code_oauth_token" { module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "3.0.0" + version = "3.0.1" agent_id = coder_agent.example.id workdir = "/home/coder/project" claude_code_oauth_token = var.claude_code_oauth_token } ``` +### Usage with AWS Bedrock + +#### Prerequisites + +AWS account with Bedrock access, Claude models enabled in Bedrock console, appropriate IAM permissions. + +Configure Claude Code to use AWS Bedrock for accessing Claude models through your AWS infrastructure. + +```tf +resource "coder_env" "bedrock_use" { + agent_id = coder_agent.example.id + name = "CLAUDE_CODE_USE_BEDROCK" + value = "1" +} + +resource "coder_env" "aws_region" { + agent_id = coder_agent.example.id + name = "AWS_REGION" + value = "us-east-1" # Choose your preferred region +} + +# Option 1: Using AWS credentials +resource "coder_env" "aws_access_key" { + agent_id = coder_agent.example.id + name = "AWS_ACCESS_KEY_ID" + value = "your-access-key-id" +} + +resource "coder_env" "aws_secret_key" { + agent_id = coder_agent.example.id + name = "AWS_SECRET_ACCESS_KEY" + value = "your-secret-access-key" + sensitive = true +} + +# Option 2: Using Bedrock API key (simpler) +resource "coder_env" "bedrock_api_key" { + agent_id = coder_agent.example.id + name = "AWS_BEARER_TOKEN_BEDROCK" + value = "your-bedrock-api-key" + sensitive = true +} + +module "claude-code" { + source = "registry.coder.com/coder/claude-code/coder" + version = "3.0.1" + agent_id = coder_agent.example.id + workdir = "/home/coder/project" + model = "us.anthropic.claude-3-7-sonnet-20250219-v1:0" +} +``` + +> [!NOTE] +> For additional Bedrock configuration options (model selection, token limits, region overrides, etc.), see the [Claude Code Bedrock documentation](https://docs.claude.com/en/docs/claude-code/amazon-bedrock). + +### Usage with Google Vertex AI + +#### Prerequisites + +GCP project with Vertex AI API enabled, Claude models enabled through Model Garden, Google Cloud authentication configured, appropriate IAM permissions. + +Configure Claude Code to use Google Vertex AI for accessing Claude models through Google Cloud Platform. + +```tf +resource "coder_env" "vertex_use" { + agent_id = coder_agent.example.id + name = "CLAUDE_CODE_USE_VERTEX" + value = "1" +} + +resource "coder_env" "vertex_project_id" { + agent_id = coder_agent.example.id + name = "ANTHROPIC_VERTEX_PROJECT_ID" + value = "your-gcp-project-id" +} + +resource "coder_env" "cloud_ml_region" { + agent_id = coder_agent.example.id + name = "CLOUD_ML_REGION" + value = "global" +} + +module "claude-code" { + source = "registry.coder.com/coder/claude-code/coder" + version = "3.0.1" + agent_id = coder_agent.example.id + workdir = "/home/coder/project" + model = "claude-sonnet-4@20250514" +} +``` + +> [!NOTE] +> For additional Vertex AI configuration options (model selection, token limits, region overrides, etc.), see the [Claude Code Vertex AI documentation](https://docs.claude.com/en/docs/claude-code/google-vertex-ai). + ## Troubleshooting If you encounter any issues, check the log files in the `~/.claude-module` directory within your workspace for detailed information. From 9f330d21e97a7fc7f86ca2890c5bd47e6597a2db Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Thu, 25 Sep 2025 20:35:48 -0500 Subject: [PATCH 2/3] feat: add support for AWS Bedrock and Google Vertex AI in Claude Code module --- registry/coder/modules/claude-code/README.md | 92 ++++++---------- registry/coder/modules/claude-code/main.tf | 106 +++++++++++++++++++ 2 files changed, 137 insertions(+), 61 deletions(-) diff --git a/registry/coder/modules/claude-code/README.md b/registry/coder/modules/claude-code/README.md index 772f20b81..9aa0a12f5 100644 --- a/registry/coder/modules/claude-code/README.md +++ b/registry/coder/modules/claude-code/README.md @@ -124,51 +124,26 @@ AWS account with Bedrock access, Claude models enabled in Bedrock console, appro Configure Claude Code to use AWS Bedrock for accessing Claude models through your AWS infrastructure. ```tf -resource "coder_env" "bedrock_use" { - agent_id = coder_agent.example.id - name = "CLAUDE_CODE_USE_BEDROCK" - value = "1" -} - -resource "coder_env" "aws_region" { - agent_id = coder_agent.example.id - name = "AWS_REGION" - value = "us-east-1" # Choose your preferred region -} - -# Option 1: Using AWS credentials -resource "coder_env" "aws_access_key" { - agent_id = coder_agent.example.id - name = "AWS_ACCESS_KEY_ID" - value = "your-access-key-id" -} - -resource "coder_env" "aws_secret_key" { - agent_id = coder_agent.example.id - name = "AWS_SECRET_ACCESS_KEY" - value = "your-secret-access-key" - sensitive = true -} +module "claude-code" { + source = "registry.coder.com/coder/claude-code/coder" + version = "3.0.1" + agent_id = coder_agent.example.id + workdir = "/home/coder/project" + model = "anthropic.claude-3-5-sonnet-20241022-v2:0" # Bedrock model ID + use_bedrock = true + aws_region = "us-west-2" -# Option 2: Using Bedrock API key (simpler) -resource "coder_env" "bedrock_api_key" { - agent_id = coder_agent.example.id - name = "AWS_BEARER_TOKEN_BEDROCK" - value = "your-bedrock-api-key" - sensitive = true -} + # Option 1: Using AWS credentials + aws_access_key_id = "AKIA..." + aws_secret_access_key = "your-secret-key" -module "claude-code" { - source = "registry.coder.com/coder/claude-code/coder" - version = "3.0.1" - agent_id = coder_agent.example.id - workdir = "/home/coder/project" - model = "us.anthropic.claude-3-7-sonnet-20250219-v1:0" + # Option 2: Using Bedrock API key (alternative to AWS credentials) + # aws_bearer_token_bedrock = "your-bedrock-api-key" } ``` > [!NOTE] -> For additional Bedrock configuration options (model selection, token limits, region overrides, etc.), see the [Claude Code Bedrock documentation](https://docs.claude.com/en/docs/claude-code/amazon-bedrock). +> For model IDs and available models in your region, refer to the [AWS Bedrock documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html). For additional Bedrock configuration options (model selection, token limits, region overrides, etc.), see the [Claude Code Bedrock documentation](https://docs.claude.com/en/docs/claude-code/amazon-bedrock). ### Usage with Google Vertex AI @@ -179,32 +154,27 @@ GCP project with Vertex AI API enabled, Claude models enabled through Model Gard Configure Claude Code to use Google Vertex AI for accessing Claude models through Google Cloud Platform. ```tf -resource "coder_env" "vertex_use" { - agent_id = coder_agent.example.id - name = "CLAUDE_CODE_USE_VERTEX" - value = "1" +module "claude-code" { + source = "registry.coder.com/coder/claude-code/coder" + version = "3.0.1" + agent_id = coder_agent.example.id + workdir = "/home/coder/project" + model = "claude-3-5-sonnet@20241022" # Vertex AI model name + use_vertex = true + vertex_project_id = "your-gcp-project-id" + vertex_region = "us-central1" # or "global" } +``` -resource "coder_env" "vertex_project_id" { - agent_id = coder_agent.example.id - name = "ANTHROPIC_VERTEX_PROJECT_ID" - value = "your-gcp-project-id" -} +**Authentication** -resource "coder_env" "cloud_ml_region" { - agent_id = coder_agent.example.id - name = "CLOUD_ML_REGION" - value = "global" -} +Vertex AI uses Google Cloud authentication. Ensure your workspace has access to Google Cloud credentials through one of these methods: -module "claude-code" { - source = "registry.coder.com/coder/claude-code/coder" - version = "3.0.1" - agent_id = coder_agent.example.id - workdir = "/home/coder/project" - model = "claude-sonnet-4@20250514" -} -``` +1. **Application Default Credentials (ADC)**: Set up through `gcloud auth application-default login` +2. **Service Account**: Configure `GOOGLE_APPLICATION_CREDENTIALS` environment variable +3. **Workload Identity**: For GKE deployments + +Refer to the [Google Cloud authentication documentation](https://cloud.google.com/docs/authentication/application-default-credentials) for detailed setup instructions. > [!NOTE] > For additional Vertex AI configuration options (model selection, token limits, region overrides, etc.), see the [Claude Code Vertex AI documentation](https://docs.claude.com/en/docs/claude-code/google-vertex-ai). diff --git a/registry/coder/modules/claude-code/main.tf b/registry/coder/modules/claude-code/main.tf index d391e479e..b01d484f4 100644 --- a/registry/coder/modules/claude-code/main.tf +++ b/registry/coder/modules/claude-code/main.tf @@ -192,6 +192,57 @@ variable "claude_md_path" { default = "$HOME/.claude/CLAUDE.md" } +variable "use_bedrock" { + type = bool + description = "Whether to use AWS Bedrock for Claude Code." + default = false +} + +variable "aws_region" { + type = string + description = "AWS region for Bedrock." + default = "" +} + +variable "aws_access_key_id" { + type = string + description = "AWS access key ID for Bedrock authentication." + default = "" + sensitive = true +} + +variable "aws_secret_access_key" { + type = string + description = "AWS secret access key for Bedrock authentication." + default = "" + sensitive = true +} + +variable "aws_bearer_token_bedrock" { + type = string + description = "AWS Bedrock API key for simplified authentication." + default = "" + sensitive = true +} + +variable "use_vertex" { + type = bool + description = "Whether to use Google Vertex AI for Claude Code." + default = false +} + +variable "vertex_project_id" { + type = string + description = "Google Cloud project ID for Vertex AI." + default = "" +} + +variable "vertex_region" { + type = string + description = "Google Cloud region for Vertex AI." + default = "global" +} + resource "coder_env" "claude_code_md_path" { count = var.claude_md_path == "" ? 0 : 1 @@ -221,6 +272,61 @@ resource "coder_env" "claude_api_key" { name = "CLAUDE_API_KEY" value = var.claude_api_key } +resource "coder_env" "use_bedrock" { + count = var.use_bedrock ? 1 : 0 + agent_id = var.agent_id + name = "CLAUDE_CODE_USE_BEDROCK" + value = "1" +} + +resource "coder_env" "aws_region" { + count = var.use_bedrock && var.aws_region != "" ? 1 : 0 + agent_id = var.agent_id + name = "AWS_REGION" + value = var.aws_region +} + +resource "coder_env" "aws_access_key_id" { + count = var.use_bedrock && var.aws_access_key_id != "" ? 1 : 0 + agent_id = var.agent_id + name = "AWS_ACCESS_KEY_ID" + value = var.aws_access_key_id +} + +resource "coder_env" "aws_secret_access_key" { + count = var.use_bedrock && var.aws_secret_access_key != "" ? 1 : 0 + agent_id = var.agent_id + name = "AWS_SECRET_ACCESS_KEY" + value = var.aws_secret_access_key +} + +resource "coder_env" "aws_bearer_token_bedrock" { + count = var.use_bedrock && var.aws_bearer_token_bedrock != "" ? 1 : 0 + agent_id = var.agent_id + name = "AWS_BEARER_TOKEN_BEDROCK" + value = var.aws_bearer_token_bedrock +} + +resource "coder_env" "use_vertex" { + count = var.use_vertex ? 1 : 0 + agent_id = var.agent_id + name = "CLAUDE_CODE_USE_VERTEX" + value = "1" +} + +resource "coder_env" "vertex_project_id" { + count = var.use_vertex && var.vertex_project_id != "" ? 1 : 0 + agent_id = var.agent_id + name = "ANTHROPIC_VERTEX_PROJECT_ID" + value = var.vertex_project_id +} + +resource "coder_env" "vertex_region" { + count = var.use_vertex ? 1 : 0 + agent_id = var.agent_id + name = "CLOUD_ML_REGION" + value = var.vertex_region +} locals { # we have to trim the slash because otherwise coder exp mcp will From 0d5a20696d8bf38b7ed50181ca69292521a2c9f8 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Thu, 25 Sep 2025 21:09:54 -0500 Subject: [PATCH 3/3] feat: update Claude Code module version to 3.1.0 --- registry/coder/modules/claude-code/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/registry/coder/modules/claude-code/README.md b/registry/coder/modules/claude-code/README.md index 9aa0a12f5..223056246 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 = "3.0.1" + version = "3.1.0" agent_id = coder_agent.example.id workdir = "/home/coder/project" claude_api_key = "xxxx-xxxxx-xxxx" @@ -49,7 +49,7 @@ data "coder_parameter" "ai_prompt" { module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "3.0.1" + version = "3.1.0" agent_id = coder_agent.example.id workdir = "/home/coder/project" @@ -85,7 +85,7 @@ Run and configure Claude Code as a standalone CLI in your workspace. ```tf module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "3.0.1" + version = "3.1.0" agent_id = coder_agent.example.id workdir = "/home/coder" install_claude_code = true @@ -108,7 +108,7 @@ variable "claude_code_oauth_token" { module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "3.0.1" + version = "3.1.0" agent_id = coder_agent.example.id workdir = "/home/coder/project" claude_code_oauth_token = var.claude_code_oauth_token @@ -126,7 +126,7 @@ Configure Claude Code to use AWS Bedrock for accessing Claude models through you ```tf module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "3.0.1" + version = "3.1.0" agent_id = coder_agent.example.id workdir = "/home/coder/project" model = "anthropic.claude-3-5-sonnet-20241022-v2:0" # Bedrock model ID @@ -156,7 +156,7 @@ Configure Claude Code to use Google Vertex AI for accessing Claude models throug ```tf module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "3.0.1" + version = "3.1.0" agent_id = coder_agent.example.id workdir = "/home/coder/project" model = "claude-3-5-sonnet@20241022" # Vertex AI model name