mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
Forgot to add
This commit is contained in:
27
2025/day02/range2/main.tf
Normal file
27
2025/day02/range2/main.tf
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user