Compare commits

...

7 Commits

Author SHA1 Message Date
DevCats b27e83caca Merge branch 'main' into cat/claude-code-3-1-0 2025-10-02 16:54:00 -05:00
Susana Ferreira 2de6a57a3f fix: claude-code api_key terraform test (#444)
## Description

Fix claude-code module `test_claude_code_with_api_key` terraform test.
2025-10-01 18:21:54 -05:00
Jiachen Jiang 60fec19d7d Update README.md (#440)
Added recommendation to the Gateway README, pointing to the Toolbox
module.

---------

Co-authored-by: DevCats <christofer@coder.com>
2025-09-30 09:14:16 -07:00
DevCats 61d0287b6e Merge branch 'main' into cat/claude-code-3-1-0 2025-09-30 08:32:19 -05:00
DevelopmentCats 0d5a20696d feat: update Claude Code module version to 3.1.0 2025-09-25 21:09:54 -05:00
DevelopmentCats 9f330d21e9 feat: add support for AWS Bedrock and Google Vertex AI in Claude Code module 2025-09-25 20:35:48 -05:00
DevelopmentCats 571f921505 docs: update Claude Code module to version 3.0.1 and add AWS Bedrock and Google Vertex AI usage examples 2025-09-24 19:52:59 -05:00
4 changed files with 183 additions and 11 deletions
+68 -4
View File
@@ -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,13 +108,77 @@ 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
}
```
### 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
module "claude-code" {
source = "registry.coder.com/coder/claude-code/coder"
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
use_bedrock = true
aws_region = "us-west-2"
# Option 1: Using AWS credentials
aws_access_key_id = "AKIA..."
aws_secret_access_key = "your-secret-key"
# Option 2: Using Bedrock API key (alternative to AWS credentials)
# aws_bearer_token_bedrock = "your-bedrock-api-key"
}
```
> [!NOTE]
> 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
#### 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
module "claude-code" {
source = "registry.coder.com/coder/claude-code/coder"
version = "3.1.0"
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"
}
```
**Authentication**
Vertex AI uses Google Cloud authentication. Ensure your workspace has access to Google Cloud credentials through one of these methods:
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).
## Troubleshooting
If you encounter any issues, check the log files in the `~/.claude-module` directory within your workspace for detailed information.
+106
View File
@@ -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
@@ -42,7 +42,7 @@ run "test_claude_code_with_api_key" {
}
assert {
condition = coder_env.claude_api_key.value == "test-api-key-123"
condition = coder_env.claude_api_key[0].value == "test-api-key-123"
error_message = "Claude API key value should match the input"
}
}
@@ -10,6 +10,8 @@ tags: [ide, jetbrains, parameter, gateway]
This module adds a JetBrains Gateway Button to open any workspace with a single click.
> We recommend using the [Coder Toolbox module](https://registry.coder.com/modules/coder/jetbrains), which offers significant stability and connectivity benefits over Gateway. Reference our [documentation](https://coder.com/docs/user-guides/workspace-access/jetbrains/toolbox) for more information.
JetBrains recommends a minimum of 4 CPU cores and 8GB of RAM.
Consult the [JetBrains documentation](https://www.jetbrains.com/help/idea/prerequisites.html#min_requirements) to confirm other system requirements.
@@ -17,7 +19,7 @@ Consult the [JetBrains documentation](https://www.jetbrains.com/help/idea/prereq
module "jetbrains_gateway" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/jetbrains-gateway/coder"
version = "1.2.2"
version = "1.2.3"
agent_id = coder_agent.example.id
folder = "/home/coder/example"
jetbrains_ides = ["CL", "GO", "IU", "PY", "WS"]
@@ -35,7 +37,7 @@ module "jetbrains_gateway" {
module "jetbrains_gateway" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/jetbrains-gateway/coder"
version = "1.2.2"
version = "1.2.3"
agent_id = coder_agent.example.id
folder = "/home/coder/example"
jetbrains_ides = ["GO", "WS"]
@@ -49,7 +51,7 @@ module "jetbrains_gateway" {
module "jetbrains_gateway" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/jetbrains-gateway/coder"
version = "1.2.2"
version = "1.2.3"
agent_id = coder_agent.example.id
folder = "/home/coder/example"
jetbrains_ides = ["IU", "PY"]
@@ -64,7 +66,7 @@ module "jetbrains_gateway" {
module "jetbrains_gateway" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/jetbrains-gateway/coder"
version = "1.2.2"
version = "1.2.3"
agent_id = coder_agent.example.id
folder = "/home/coder/example"
jetbrains_ides = ["IU", "PY"]
@@ -89,7 +91,7 @@ module "jetbrains_gateway" {
module "jetbrains_gateway" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/jetbrains-gateway/coder"
version = "1.2.2"
version = "1.2.3"
agent_id = coder_agent.example.id
folder = "/home/coder/example"
jetbrains_ides = ["GO", "WS"]
@@ -107,7 +109,7 @@ Due to the highest priority of the `ide_download_link` parameter in the `(jetbra
module "jetbrains_gateway" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/jetbrains-gateway/coder"
version = "1.2.2"
version = "1.2.3"
agent_id = coder_agent.example.id
folder = "/home/coder/example"
jetbrains_ides = ["GO", "WS"]