From 571f9215059a2f9e408f365ba0d5ede0fec6e3d0 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Wed, 24 Sep 2025 19:52:59 -0500 Subject: [PATCH 1/5] 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 347dde7a7e4bfccbb195b0381e48709e4f5e20fe Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Thu, 2 Oct 2025 15:52:31 -0500 Subject: [PATCH 2/5] chore: bump to 3.0.2 --- 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 772f20b81..1ba5d985c 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.0.2" 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.0.2" 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.0.2" 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.0.2" agent_id = coder_agent.example.id workdir = "/home/coder/project" claude_code_oauth_token = var.claude_code_oauth_token @@ -160,7 +160,7 @@ resource "coder_env" "bedrock_api_key" { module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "3.0.1" + version = "3.0.2" agent_id = coder_agent.example.id workdir = "/home/coder/project" model = "us.anthropic.claude-3-7-sonnet-20250219-v1:0" @@ -199,7 +199,7 @@ resource "coder_env" "cloud_ml_region" { module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "3.0.1" + version = "3.0.2" agent_id = coder_agent.example.id workdir = "/home/coder/project" model = "claude-sonnet-4@20250514" From 6f0b96642046e2907b061dd58b8316215a83446e Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Thu, 9 Oct 2025 14:41:04 -0500 Subject: [PATCH 3/5] feat: update AWS credentials handling in claude-code module for bedrock after testing observations --- registry/coder/modules/claude-code/README.md | 37 +++++++++++++++----- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/registry/coder/modules/claude-code/README.md b/registry/coder/modules/claude-code/README.md index 24efba27f..6d065971e 100644 --- a/registry/coder/modules/claude-code/README.md +++ b/registry/coder/modules/claude-code/README.md @@ -137,25 +137,46 @@ resource "coder_env" "aws_region" { } # Option 1: Using AWS credentials -resource "coder_env" "aws_access_key" { + +variable "aws_access_key_id" { + type = string + description = "Your AWS access key ID. Create this in the AWS IAM console under 'Security credentials'." + sensitive = true + value = "xxxx-xxx-xxxx" +} + +variable "aws_secret_access_key" { + type = string + description = "Your AWS secret access key. This is shown once when you create an access key in the AWS IAM console." + sensitive = true + value = "xxxx-xxx-xxxx" +} + +resource "coder_env" "aws_access_key_id" { agent_id = coder_agent.example.id name = "AWS_ACCESS_KEY_ID" - value = "your-access-key-id" + value = var.aws_access_key_id } -resource "coder_env" "aws_secret_key" { +resource "coder_env" "aws_secret_access_key" { agent_id = coder_agent.example.id name = "AWS_SECRET_ACCESS_KEY" - value = "your-secret-access-key" - sensitive = true + value = var.aws_secret_access_key" } # Option 2: Using Bedrock API key (simpler) + +variable "aws_bearer_token_bedrock" { + type = string + description = "Your AWS Bedrock bearer token. This provides access to Bedrock without needing separate access key and secret key." + sensitive = true + value = "xxxx-xxx-xxxx" +} + resource "coder_env" "bedrock_api_key" { agent_id = coder_agent.example.id name = "AWS_BEARER_TOKEN_BEDROCK" - value = "your-bedrock-api-key" - sensitive = true + value = var.aws_bearer_token_bedrock } module "claude-code" { @@ -163,7 +184,7 @@ module "claude-code" { version = "3.1.1" agent_id = coder_agent.example.id workdir = "/home/coder/project" - model = "us.anthropic.claude-3-7-sonnet-20250219-v1:0" + model = "global.anthropic.claude-sonnet-4-5-20250929-v1:0" } ``` From 8b13760ac815d798a31a7a2f3686b5941de6ab3f Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Thu, 9 Oct 2025 14:42:55 -0500 Subject: [PATCH 4/5] chore: bun run fmt --- 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 6d065971e..9f2582e26 100644 --- a/registry/coder/modules/claude-code/README.md +++ b/registry/coder/modules/claude-code/README.md @@ -159,9 +159,9 @@ resource "coder_env" "aws_access_key_id" { } resource "coder_env" "aws_secret_access_key" { - agent_id = coder_agent.example.id - name = "AWS_SECRET_ACCESS_KEY" - value = var.aws_secret_access_key" + agent_id = coder_agent.example.id + name = "AWS_SECRET_ACCESS_KEY" + value = var.aws_secret_access_key } # Option 2: Using Bedrock API key (simpler) @@ -174,9 +174,9 @@ variable "aws_bearer_token_bedrock" { } resource "coder_env" "bedrock_api_key" { - agent_id = coder_agent.example.id - name = "AWS_BEARER_TOKEN_BEDROCK" - value = var.aws_bearer_token_bedrock + agent_id = coder_agent.example.id + name = "AWS_BEARER_TOKEN_BEDROCK" + value = var.aws_bearer_token_bedrock } module "claude-code" { From f1c7c9fb9aa5f444a1862dfeec0b6f05409509c5 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Tue, 14 Oct 2025 09:10:55 -0500 Subject: [PATCH 5/5] feat: update vertex examples with tested working examples --- registry/coder/modules/claude-code/README.md | 42 +++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/registry/coder/modules/claude-code/README.md b/registry/coder/modules/claude-code/README.md index 9f2582e26..ed10e2a56 100644 --- a/registry/coder/modules/claude-code/README.md +++ b/registry/coder/modules/claude-code/README.md @@ -195,11 +195,17 @@ module "claude-code" { #### Prerequisites -GCP project with Vertex AI API enabled, Claude models enabled through Model Garden, Google Cloud authentication configured, appropriate IAM permissions. +GCP project with Vertex AI API enabled, Claude models enabled through Model Garden, service account with Vertex AI permissions, appropriate IAM permissions (Vertex AI User role). Configure Claude Code to use Google Vertex AI for accessing Claude models through Google Cloud Platform. ```tf +variable "vertex_sa_json" { + type = string + description = "The complete JSON content of your Google Cloud service account key file. Create a service account in the GCP Console under 'IAM & Admin > Service Accounts', then create and download a JSON key. Copy the entire JSON content into this variable." + sensitive = true +} + resource "coder_env" "vertex_use" { agent_id = coder_agent.example.id name = "CLAUDE_CODE_USE_VERTEX" @@ -218,12 +224,46 @@ resource "coder_env" "cloud_ml_region" { value = "global" } +resource "coder_env" "vertex_sa_json" { + agent_id = coder_agent.example.id + name = "VERTEX_SA_JSON" + value = var.vertex_sa_json +} + +resource "coder_env" "google_application_credentials" { + agent_id = coder_agent.example.id + name = "GOOGLE_APPLICATION_CREDENTIALS" + value = "/tmp/gcp-sa.json" +} + module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" version = "3.1.1" agent_id = coder_agent.example.id workdir = "/home/coder/project" model = "claude-sonnet-4@20250514" + + pre_install_script = <<-EOT + #!/bin/bash + # Write the service account JSON to a file + echo "$VERTEX_SA_JSON" > /tmp/gcp-sa.json + + # Install prerequisite packages + sudo apt-get update + sudo apt-get install -y apt-transport-https ca-certificates gnupg curl + + # Add Google Cloud public key + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg + + # Add Google Cloud SDK repo to apt sources + echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee /etc/apt/sources.list.d/google-cloud-sdk.list + + # Update and install the Google Cloud SDK + sudo apt-get update && sudo apt-get install -y google-cloud-cli + + # Authenticate gcloud with the service account + gcloud auth activate-service-account --key-file=/tmp/gcp-sa.json + EOT } ```