Skip to content

bug: The condition for variable "agentapi_subdomain" can only refer to the variable itself, using var.agentapi_subdomain. #20982

@llermaly

Description

@llermaly

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I'm trying to install the claude code template locally and I'm getting an error. I'm following the documentation of using a Claude subscription.

Relevant Log Output

Initializing the backend...
Initializing modules...
Downloading registry.coder.com/coder/claude-code/coder 4.2.3 for claude-code...
- claude-code in .terraform/modules/claude-code
Downloading registry.coder.com/coder/agentapi/coder 2.0.0 for claude-code.agentapi...
- claude-code.agentapi in .terraform/modules/claude-code.agentapi
There are some problems with the configuration, described below.
The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.
Error: Invalid reference in variable validation
  on .terraform/modules/claude-code.agentapi/main.tf line 146, in variable "agentapi_subdomain":
 146:       can(regex("^v\\d+\\.\\d+\\.\\d+$", var.agentapi_version)) ?
The condition for variable "agentapi_subdomain" can only refer to the
variable itself, using var.agentapi_subdomain.
Error: Invalid reference in variable validation
  on .terraform/modules/claude-code.agentapi/main.tf line 147, in variable "agentapi_subdomain":
 147:       can(regex(local.agentapi_subdomain_false_min_version_expr, var.agentapi_version)) :
The condition for variable "agentapi_subdomain" can only refer to the
variable itself, using var.agentapi_subdomain.
Error: Invalid reference in variable validation
  on .terraform/modules/claude-code.agentapi/main.tf line 147, in variable "agentapi_subdomain":
 147:       can(regex(local.agentapi_subdomain_false_min_version_expr, var.agentapi_version)) :
The condition for variable "agentapi_subdomain" can only refer to the
variable itself, using var.agentapi_subdomain.

Expected Behavior

Template installs

Steps to Reproduce

Create template file:

variable "claude_code_oauth_token" {
  type        = string
  description = "Generate one using `claude setup-token` command"
  sensitive   = true
}

module "claude-code" {
  source                  = "registry.coder.com/coder/claude-code/coder"
  version                 = "4.2.3"
  agent_id                = coder_agent.main.id
  workdir                 = "/home/coder/project"
  claude_code_oauth_token = var.claude_code_oauth_token
}

Upload to templates.

Environment

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    waiting-for-infoThe issue creator is asked to provide more information.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions