Implement day 4 in Terraform

This commit is contained in:
2024-12-05 22:14:35 +01:00
parent 0967a3dfe3
commit ecfe5e9f20
6 changed files with 194 additions and 0 deletions

28
2024/bonus/day04/main.tf Normal file
View File

@@ -0,0 +1,28 @@
variable "input" {
type = string
}
locals {
grid = split("\n", chomp(var.input))
height = length(local.grid)
width = length(local.grid[0])
}
module "check_point" {
source = "./check_point"
count = local.width * local.height
width = local.width
height = local.height
grid = local.grid
index = count.index
}
output "part1" {
value = sum(module.check_point[*].xmas)
}
output "part2" {
value = sum(module.check_point[*].x_mas)
}