From db69453a7e14fe96a183d4b97a56af6ccf5c3873 Mon Sep 17 00:00:00 2001
From: Rob Kooper <kooper@illinois.edu>
Date: Wed, 30 Aug 2023 15:30:09 -0500
Subject: [PATCH] fix critical issue where nodes could be destroyed

---
 CHANGELOG.md                    | 7 +++++++
 terraform/modules/rke1/nodes.tf | 9 +++++++++
 2 files changed, 16 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index eb0ead6..52f77c3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
 
 The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
 
+## 2.3.2 - 2023-08-30
+
+CRITICAL the version 2.2.0 - 2.3.1 could result in all nodes in the cluster being deleted in the case of changes to the userdata.
+
+### Changed
+- don't remove nodes when there are changes to userdata, key, availability zone, block_device
+
 ## 2.3.1 - 2023-08-26
 
 ### Changed
diff --git a/terraform/modules/rke1/nodes.tf b/terraform/modules/rke1/nodes.tf
index 55c819f..a6698d6 100644
--- a/terraform/modules/rke1/nodes.tf
+++ b/terraform/modules/rke1/nodes.tf
@@ -75,6 +75,15 @@ resource "openstack_compute_instance_v2" "machine" {
     node_options = lookup(local.node_options, each.value.role, "--worker")
     node_labels  = join(" ", [for l in each.value.labels : format("-l %s", replace(l, " ", "_"))])
   }))
+
+  lifecycle {
+    ignore_changes = [
+      key_pair,
+      block_device,
+      user_data,
+      availability_zone
+    ]
+  }
 }
 
 # ----------------------------------------------------------------------
-- 
GitLab