From f1738b6e646249b0492510f0c718a061b81538af Mon Sep 17 00:00:00 2001
From: zowoq <59103226+zowoq@users.noreply.github.com>
Date: Wed, 15 Mar 2023 10:50:57 +1000
Subject: [PATCH 1/2] tasks.py: add update-terraform

---
 tasks.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tasks.py b/tasks.py
index 568b8ec..c4ceaba 100644
--- a/tasks.py
+++ b/tasks.py
@@ -198,6 +198,25 @@ def scan_age_keys(c, host):
     )
 
 
+@task
+def update_terraform(c):
+    """
+    Update terraform devshell flake
+    """
+    with c.cd("terraform"):
+        c.run(
+            """
+system="$(nix eval --impure --raw --expr 'builtins.currentSystem')"
+old="$(nix build --no-link --print-out-paths ".#devShells.${system}.default")"
+nix flake update --commit-lock-file
+new="$(nix build --no-link --print-out-paths ".#devShells.${system}.default")"
+commit="$(git log --pretty=format:%B -1)"
+diff="$(nix store diff-closures "${old}" "${new}" | awk -F ',' '/terraform/ && /→/ {print $1}')"
+git commit --amend -m "${commit}" -m "Terraform updates:" -m "${diff}"
+"""
+        )
+
+
 @task
 def format_disks(c, hosts="", disks=""):
     """

From 200854019a82ed9722d1f13cafc12bb863ed7342 Mon Sep 17 00:00:00 2001
From: zowoq <59103226+zowoq@users.noreply.github.com>
Date: Wed, 15 Mar 2023 10:53:55 +1000
Subject: [PATCH 2/2] terraform/flake.lock: Update
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/efc59894b1ba73cb745676616c56c780383d6788' (2023-02-19)
  → 'github:NixOS/nixpkgs/1474943fd91fbe5567f7582acf568e0f999f4af1' (2023-03-14)

Terraform updates:

terraform: 1.3.9 → 1.4.0
terraform-provider-cloudflare: 3.33.1 → 4.1.0
terraform-provider-external: 2.2.3 → 2.3.1
---
 terraform/flake.lock | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/terraform/flake.lock b/terraform/flake.lock
index fdb1766..aeaa43a 100644
--- a/terraform/flake.lock
+++ b/terraform/flake.lock
@@ -2,11 +2,11 @@
   "nodes": {
     "nixpkgs": {
       "locked": {
-        "lastModified": 1676795730,
-        "narHash": "sha256-X69A9BdcPTySJJ7DqS4wc8b6eqGKi32jCSyaBsz4WB0=",
+        "lastModified": 1678780369,
+        "narHash": "sha256-D8wM0K1EkWLwbUu9fohC57+n89zC9qQ3hdC9Bys5GYw=",
         "owner": "NixOS",
         "repo": "nixpkgs",
-        "rev": "efc59894b1ba73cb745676616c56c780383d6788",
+        "rev": "1474943fd91fbe5567f7582acf568e0f999f4af1",
         "type": "github"
       },
       "original": {