mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 12:50:32 +01:00
28 lines
424 B
HCL
28 lines
424 B
HCL
variable "min" {
|
|
type = number
|
|
}
|
|
|
|
variable "max" {
|
|
type = number
|
|
}
|
|
|
|
locals {
|
|
digits = length(tostring(var.max))
|
|
}
|
|
|
|
module "range" {
|
|
source = "../range"
|
|
count = local.digits
|
|
max = var.max
|
|
min = var.min
|
|
repetitions = count.index + 1
|
|
}
|
|
|
|
locals {
|
|
results = setunion(module.range[*].invalid...)
|
|
}
|
|
|
|
output "invalid_sum" {
|
|
value = length(local.results) > 0 ? sum(local.results) : 0
|
|
}
|