Skip to content

Commit 54a7bb0

Browse files
docs: add usage examples for bedrock and vertex (#431)
Closes # ## Description Adds Usage Examples for Vertex and Bedrock as described in the linked documentation. ## Type of Change - [ ] New module - [ ] Bug fix - [ ] Feature/enhancement - [X] Documentation - [ ] Other ## Module Information <!-- Delete this section if not applicable --> **Path:** `registry/coder/modules/claude-code` **New version:** `v3.0.1` **Breaking change:** [ ] Yes [X] No ## Testing & Validation - [X] Tests pass (`bun test`) - [X] Code formatted (`bun run fmt`) - [ ] Changes tested locally ## Related Issues <!-- Link related issues or write "None" if not applicable -->
1 parent 50f4d53 commit 54a7bb0

File tree

1 file changed

+159
-4
lines changed

1 file changed

+159
-4
lines changed

registry/coder/modules/claude-code/README.md

Lines changed: 159 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Run the [Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude
1313
```tf
1414
module "claude-code" {
1515
source = "registry.coder.com/coder/claude-code/coder"
16-
version = "3.1.0"
16+
version = "3.1.1"
1717
agent_id = coder_agent.example.id
1818
workdir = "/home/coder/project"
1919
claude_api_key = "xxxx-xxxxx-xxxx"
@@ -49,7 +49,7 @@ data "coder_parameter" "ai_prompt" {
4949
5050
module "claude-code" {
5151
source = "registry.coder.com/coder/claude-code/coder"
52-
version = "3.1.0"
52+
version = "3.1.1"
5353
agent_id = coder_agent.example.id
5454
workdir = "/home/coder/project"
5555
@@ -85,7 +85,7 @@ Run and configure Claude Code as a standalone CLI in your workspace.
8585
```tf
8686
module "claude-code" {
8787
source = "registry.coder.com/coder/claude-code/coder"
88-
version = "3.1.0"
88+
version = "3.1.1"
8989
agent_id = coder_agent.example.id
9090
workdir = "/home/coder"
9191
install_claude_code = true
@@ -108,13 +108,168 @@ variable "claude_code_oauth_token" {
108108
109109
module "claude-code" {
110110
source = "registry.coder.com/coder/claude-code/coder"
111-
version = "3.0.3"
111+
version = "3.1.1"
112112
agent_id = coder_agent.example.id
113113
workdir = "/home/coder/project"
114114
claude_code_oauth_token = var.claude_code_oauth_token
115115
}
116116
```
117117

118+
### Usage with AWS Bedrock
119+
120+
#### Prerequisites
121+
122+
AWS account with Bedrock access, Claude models enabled in Bedrock console, appropriate IAM permissions.
123+
124+
Configure Claude Code to use AWS Bedrock for accessing Claude models through your AWS infrastructure.
125+
126+
```tf
127+
resource "coder_env" "bedrock_use" {
128+
agent_id = coder_agent.example.id
129+
name = "CLAUDE_CODE_USE_BEDROCK"
130+
value = "1"
131+
}
132+
133+
resource "coder_env" "aws_region" {
134+
agent_id = coder_agent.example.id
135+
name = "AWS_REGION"
136+
value = "us-east-1" # Choose your preferred region
137+
}
138+
139+
# Option 1: Using AWS credentials
140+
141+
variable "aws_access_key_id" {
142+
type = string
143+
description = "Your AWS access key ID. Create this in the AWS IAM console under 'Security credentials'."
144+
sensitive = true
145+
value = "xxxx-xxx-xxxx"
146+
}
147+
148+
variable "aws_secret_access_key" {
149+
type = string
150+
description = "Your AWS secret access key. This is shown once when you create an access key in the AWS IAM console."
151+
sensitive = true
152+
value = "xxxx-xxx-xxxx"
153+
}
154+
155+
resource "coder_env" "aws_access_key_id" {
156+
agent_id = coder_agent.example.id
157+
name = "AWS_ACCESS_KEY_ID"
158+
value = var.aws_access_key_id
159+
}
160+
161+
resource "coder_env" "aws_secret_access_key" {
162+
agent_id = coder_agent.example.id
163+
name = "AWS_SECRET_ACCESS_KEY"
164+
value = var.aws_secret_access_key
165+
}
166+
167+
# Option 2: Using Bedrock API key (simpler)
168+
169+
variable "aws_bearer_token_bedrock" {
170+
type = string
171+
description = "Your AWS Bedrock bearer token. This provides access to Bedrock without needing separate access key and secret key."
172+
sensitive = true
173+
value = "xxxx-xxx-xxxx"
174+
}
175+
176+
resource "coder_env" "bedrock_api_key" {
177+
agent_id = coder_agent.example.id
178+
name = "AWS_BEARER_TOKEN_BEDROCK"
179+
value = var.aws_bearer_token_bedrock
180+
}
181+
182+
module "claude-code" {
183+
source = "registry.coder.com/coder/claude-code/coder"
184+
version = "3.1.1"
185+
agent_id = coder_agent.example.id
186+
workdir = "/home/coder/project"
187+
model = "global.anthropic.claude-sonnet-4-5-20250929-v1:0"
188+
}
189+
```
190+
191+
> [!NOTE]
192+
> 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).
193+
194+
### Usage with Google Vertex AI
195+
196+
#### Prerequisites
197+
198+
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).
199+
200+
Configure Claude Code to use Google Vertex AI for accessing Claude models through Google Cloud Platform.
201+
202+
```tf
203+
variable "vertex_sa_json" {
204+
type = string
205+
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."
206+
sensitive = true
207+
}
208+
209+
resource "coder_env" "vertex_use" {
210+
agent_id = coder_agent.example.id
211+
name = "CLAUDE_CODE_USE_VERTEX"
212+
value = "1"
213+
}
214+
215+
resource "coder_env" "vertex_project_id" {
216+
agent_id = coder_agent.example.id
217+
name = "ANTHROPIC_VERTEX_PROJECT_ID"
218+
value = "your-gcp-project-id"
219+
}
220+
221+
resource "coder_env" "cloud_ml_region" {
222+
agent_id = coder_agent.example.id
223+
name = "CLOUD_ML_REGION"
224+
value = "global"
225+
}
226+
227+
resource "coder_env" "vertex_sa_json" {
228+
agent_id = coder_agent.example.id
229+
name = "VERTEX_SA_JSON"
230+
value = var.vertex_sa_json
231+
}
232+
233+
resource "coder_env" "google_application_credentials" {
234+
agent_id = coder_agent.example.id
235+
name = "GOOGLE_APPLICATION_CREDENTIALS"
236+
value = "/tmp/gcp-sa.json"
237+
}
238+
239+
module "claude-code" {
240+
source = "registry.coder.com/coder/claude-code/coder"
241+
version = "3.1.1"
242+
agent_id = coder_agent.example.id
243+
workdir = "/home/coder/project"
244+
model = "claude-sonnet-4@20250514"
245+
246+
pre_install_script = <<-EOT
247+
#!/bin/bash
248+
# Write the service account JSON to a file
249+
echo "$VERTEX_SA_JSON" > /tmp/gcp-sa.json
250+
251+
# Install prerequisite packages
252+
sudo apt-get update
253+
sudo apt-get install -y apt-transport-https ca-certificates gnupg curl
254+
255+
# Add Google Cloud public key
256+
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
257+
258+
# Add Google Cloud SDK repo to apt sources
259+
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
260+
261+
# Update and install the Google Cloud SDK
262+
sudo apt-get update && sudo apt-get install -y google-cloud-cli
263+
264+
# Authenticate gcloud with the service account
265+
gcloud auth activate-service-account --key-file=/tmp/gcp-sa.json
266+
EOT
267+
}
268+
```
269+
270+
> [!NOTE]
271+
> 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).
272+
118273
## Troubleshooting
119274

120275
If you encounter any issues, check the log files in the `~/.claude-module` directory within your workspace for detailed information.

0 commit comments

Comments
 (0)