Skip to content

Commit ada586f

Browse files
committed
fixup! feat: agentapi: validate var.subdomain based on agentapi_version
1 parent 1a31181 commit ada586f

File tree

1 file changed

+6
-2
lines changed
  • registry/coder/modules/agentapi

1 file changed

+6
-2
lines changed

registry/coder/modules/agentapi/main.tf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ variable "agentapi_port" {
126126
default = 3284
127127
}
128128

129+
locals {
130+
# agentapi_subdomain_false_min_version_expr matches a semantic version >= v0.3.2.
131+
agentapi_subdomain_false_min_version_expr = "^v(0\\.(3\\.[2-9]+|[4-9]+\\.\\d+)|[1-9]\\d*\\.\\d+\\.\\d+)$"
132+
}
133+
129134
variable "agentapi_subdomain" {
130135
type = bool
131136
description = "Whether to use a subdomain for AgentAPI."
@@ -134,8 +139,7 @@ variable "agentapi_subdomain" {
134139
condition = var.agentapi_subdomain || (
135140
# If version doesn't look like a valid semantic version, just allow it.
136141
!can(regex("^v\\d+\\.\\d+\\.\\d+$", var.agentapi_version))
137-
||
138-
can(regex("^v(0\\.(3\\.[2-9]+|[4-9]+\\.\\d+)|[1-9]\\d*\\.\\d+\\.\\d+)$", var.agentapi_version))
142+
|| can(regex(local.agentapi_subdomain_false_min_version_expr, var.agentapi_version))
139143
)
140144
error_message = "Running with subdomain = false is only supported by agentapi >= v0.3.2."
141145
}

0 commit comments

Comments
 (0)