mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-27 22:00:31 +01:00
Implement 2024 day 3 part 1 in Terraform
This commit is contained in:
11
2024/bonus/day03/main.tf
Normal file
11
2024/bonus/day03/main.tf
Normal file
@@ -0,0 +1,11 @@
|
||||
variable "input" {
|
||||
type = string
|
||||
}
|
||||
|
||||
locals {
|
||||
muls = regexall("mul\\((\\d+),(\\d+)\\)", var.input)
|
||||
}
|
||||
|
||||
output "part1" {
|
||||
value = sum([for mul in local.muls : parseint(mul[1], 10) * parseint(mul[0], 10)])
|
||||
}
|
||||
Reference in New Issue
Block a user