Skip to main content
min(numbers...) returns the lowest value from the given numbers.

Signature

min(numbers... number) number
At least one argument is required.

Example

Limit the number of parallel integration test runners to avoid overwhelming the test database, while still using all available workers when the suite is small:
variable "suite_size" {
  description = "Number of integration test packages"
  type        = number
}

variable "db_connections" {
  description = "Maximum database connections available to tests"
  type        = number
  default     = 10
}

computed "parallel" {
  description = "Safe parallel test count"
  expression  = min(var.suite_size, var.db_connections)
}

task "integration-test" {
  description = "Run integration tests with bounded parallelism"
  commands    = ["go test -parallel ${computed.parallel} ./test/integration/..."]
}

Notes

  • All arguments must be numbers.
  • To find the largest value, use max.