mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-27 13:50:32 +01:00
Implement day 4 in Terraform
This commit is contained in:
28
2024/bonus/day04/main.tf
Normal file
28
2024/bonus/day04/main.tf
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user