Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the claude-code Coder module to avoid Terraform “Invalid count argument” failures when enable_aibridge is used and callers add depends_on to the module block, by ensuring the coder_env.claude_api_key resource count depends only on input variables.
Changes:
- Adjust
coder_env.claude_api_key.countto be plan-time deterministic (enable_aibridgeorclaude_api_keyprovided). - Bump README examples to reference module version
4.8.2.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| registry/coder/modules/claude-code/main.tf | Makes claude_api_key env resource count independent of apply-time data source values. |
| registry/coder/modules/claude-code/README.md | Updates all usage snippets to version = "4.8.2". |
Comments suppressed due to low confidence (1)
registry/coder/modules/claude-code/main.tf:295
CLAUDE_API_KEYis being set fromlocal.claude_api_key, which isvar.claude_api_keywhen AI Bridge is disabled.variable "claude_api_key"is not markedsensitive, so this value may be rendered in plaintext in plan output/state depending on propagation. Consider marking theclaude_api_keyinput variable as sensitive (consistent with other secret inputs likevault_token).
resource "coder_env" "claude_api_key" {
count = var.enable_aibridge || var.claude_api_key != "" ? 1 : 0
agent_id = var.agent_id
name = "CLAUDE_API_KEY"
value = local.claude_api_key
}
matifali
reviewed
Mar 26, 2026
matifali
approved these changes
Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Type of Change
Module Information
Path:
registry/coder/modules/claude-codeNew version:
v4.8.2Breaking change: [ ] Yes [ ] No
Testing & Validation
bun test)bun fmt)Related Issues
Closes: #812