mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-27 05:40:32 +01:00
Implement day 19 part 1 in Terraform
This commit is contained in:
13
2024/bonus/day19/main.tf
Normal file
13
2024/bonus/day19/main.tf
Normal file
@@ -0,0 +1,13 @@
|
||||
variable "input" {
|
||||
type = string
|
||||
}
|
||||
|
||||
locals {
|
||||
parts = split("\n\n", chomp((var.input)))
|
||||
patterns = replace(local.parts[0], ", ", "|")
|
||||
valid = [for line in split("\n", local.parts[1]) : line if length(regexall("^(${local.patterns})+$", line)) > 0]
|
||||
}
|
||||
|
||||
output "part1" {
|
||||
value = length(local.valid)
|
||||
}
|
||||
Reference in New Issue
Block a user