mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 12:50:32 +01:00
29 lines
606 B
HCL
29 lines
606 B
HCL
variable "input" {
|
|
type = string
|
|
}
|
|
|
|
locals {
|
|
reports = [for line in split("\n", trim(var.input, "\n")) : split(" ", line)]
|
|
}
|
|
|
|
module "part1_valid" {
|
|
source = "./is_valid"
|
|
|
|
count = length(local.reports)
|
|
report = local.reports[count.index]
|
|
}
|
|
|
|
module "part2_valid" {
|
|
source = "./is_savable"
|
|
count = length(local.reports)
|
|
report = local.reports[count.index]
|
|
}
|
|
|
|
output "part1" {
|
|
value = length([for i in range(length(local.reports)) : true if module.part1_valid[i].valid])
|
|
}
|
|
|
|
output "part2" {
|
|
value = length([for i in range(length(local.reports)) : true if module.part2_valid[i].valid])
|
|
}
|