Skip to content

Commit c680ed7

Browse files
committed
Solve 2021 day 1 part 1 in terraform
1 parent f960d0b commit c680ed7

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

2021/Day1/Terraform/main.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
locals {
2+
raw = file("../input.txt")
3+
nums = split("\n", local.raw)
4+
increments = [for i, num in local.nums: i > 0 ? local.nums[i] > local.nums[i - 1] ? 1 : 0 : 0]
5+
counts = sum(local.increments)
6+
}
7+
8+
output "result" {
9+
value = local.counts
10+
}

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,9 @@ Node.js needs to be installed as a runtime.
3232
```sh
3333
sb run main.sb
3434
```
35+
36+
### Terraform
37+
38+
```
39+
terraform plan
40+
```

0 commit comments

Comments
 (0)