Implement day 2 in Terraform

This commit is contained in:
2024-12-02 18:25:01 +01:00
parent 5a9667094c
commit b2add928ad
6 changed files with 94 additions and 3 deletions

View File

@@ -0,0 +1,14 @@
variable "report" {
type = list(number)
}
locals {
delta = [for i in range(1, length(var.report)) : var.report[i] - var.report[i - 1]]
all_negative = alltrue([for d in local.delta : d <= -1 && d >= -3])
all_positive = alltrue([for d in local.delta : d >= 1 && d <= 3])
}
output "valid" {
value = local.all_negative || local.all_positive
}