From 216667feeec92708da905643ca25fce6a0c50ac3 Mon Sep 17 00:00:00 2001 From: simonhammes Date: Wed, 4 Dec 2024 00:38:48 +0100 Subject: [PATCH 1/2] refactor: Replace null_resource with terraform_data Closes #43 --- .terraform.lock.hcl | 18 ------------------ example/.terraform.lock.hcl | 19 ------------------- k3s_registry/main.tf | 4 ++-- main-setup.tf | 12 ++++++------ providers.tf | 4 ---- 5 files changed, 8 insertions(+), 49 deletions(-) diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl index 698c9b8..27dff76 100644 --- a/.terraform.lock.hcl +++ b/.terraform.lock.hcl @@ -55,24 +55,6 @@ provider "registry.opentofu.org/hashicorp/local" { ] } -provider "registry.opentofu.org/hashicorp/null" { - version = "3.2.2" - constraints = ">= 3.2.2, < 4.0.0" - hashes = [ - "h1:xN1tSeF/rUBfaddk/AVqk4i65z/MMM9uVZWd2cWCCH0=", - "zh:00e5877d19fb1c1d8c4b3536334a46a5c86f57146fd115c7b7b4b5d2bf2de86d", - "zh:1755c2999e73e4d73f9de670c145c9a0dc5a373802799dff06a0e9c161354163", - "zh:2b29d706353bc9c4edda6a2946af3322abe94372ffb421d81fa176f1e57e33be", - "zh:34f65259c6d2bd51582b6da536e782b181b23725782b181193b965f519fbbacd", - "zh:370f6eb744475926a1fa7464d82d46ad83c2e1148b4b21681b4cec4d75b97969", - "zh:5950bdb23b4fcc6431562d7eba3dea37844aa4220c4da2eb898ae3e4d1b64ec4", - "zh:8f3d5c8d4b9d497fec36953a227f80c76d37fc8431b683a23fb1c42b9cccbf8a", - "zh:8f6eb5e65c047bf490ad3891efecefc488503b65898d4ee106f474697ba257d7", - "zh:a7040eed688316fe00379574c72bb8c47dbe2638b038bb705647cbf224de8f72", - "zh:e561f28df04d9e51b75f33004b7767a53c45ad96e3375d86181ba1363bffbc77", - ] -} - provider "registry.opentofu.org/hashicorp/tls" { version = "4.0.5" constraints = ">= 4.0.5, < 5.0.0" diff --git a/example/.terraform.lock.hcl b/example/.terraform.lock.hcl index 90348e3..8352312 100644 --- a/example/.terraform.lock.hcl +++ b/example/.terraform.lock.hcl @@ -57,25 +57,6 @@ provider "registry.opentofu.org/hashicorp/local" { ] } -provider "registry.opentofu.org/hashicorp/null" { - version = "3.2.2" - constraints = "3.2.2" - hashes = [ - "h1:sU0t6ANQ4IfEwZbbBmcNeOCg2CDCViVb7L7QVfIHrCs=", - "h1:xN1tSeF/rUBfaddk/AVqk4i65z/MMM9uVZWd2cWCCH0=", - "zh:00e5877d19fb1c1d8c4b3536334a46a5c86f57146fd115c7b7b4b5d2bf2de86d", - "zh:1755c2999e73e4d73f9de670c145c9a0dc5a373802799dff06a0e9c161354163", - "zh:2b29d706353bc9c4edda6a2946af3322abe94372ffb421d81fa176f1e57e33be", - "zh:34f65259c6d2bd51582b6da536e782b181b23725782b181193b965f519fbbacd", - "zh:370f6eb744475926a1fa7464d82d46ad83c2e1148b4b21681b4cec4d75b97969", - "zh:5950bdb23b4fcc6431562d7eba3dea37844aa4220c4da2eb898ae3e4d1b64ec4", - "zh:8f3d5c8d4b9d497fec36953a227f80c76d37fc8431b683a23fb1c42b9cccbf8a", - "zh:8f6eb5e65c047bf490ad3891efecefc488503b65898d4ee106f474697ba257d7", - "zh:a7040eed688316fe00379574c72bb8c47dbe2638b038bb705647cbf224de8f72", - "zh:e561f28df04d9e51b75f33004b7767a53c45ad96e3375d86181ba1363bffbc77", - ] -} - provider "registry.opentofu.org/hashicorp/tls" { version = "4.0.5" constraints = "4.0.5" diff --git a/k3s_registry/main.tf b/k3s_registry/main.tf index d00cca5..6597760 100644 --- a/k3s_registry/main.tf +++ b/k3s_registry/main.tf @@ -20,8 +20,8 @@ variable "server" { }) } -resource "null_resource" "k3s_registry" { - triggers = { +resource "terraform_data" "k3s_registry" { + triggers_replace = { id = var.server.id } diff --git a/main-setup.tf b/main-setup.tf index 87a2dfa..0325e39 100644 --- a/main-setup.tf +++ b/main-setup.tf @@ -16,10 +16,10 @@ module "registry_control" { private_key = tls_private_key.ssh.private_key_openssh } -resource "null_resource" "k3sup_control" { +resource "terraform_data" "k3sup_control" { depends_on = [module.registry_control] - triggers = { + triggers_replace = { id = hcloud_server.control.id ip = hcloud_server_network.control.ip } @@ -64,18 +64,18 @@ module "registry_worker" { private_key = tls_private_key.ssh.private_key_openssh } -resource "null_resource" "k3sup_worker" { +resource "terraform_data" "k3sup_worker" { count = var.worker_count depends_on = [module.registry_worker] - triggers = { + triggers_replace = { id = hcloud_server.worker[count.index].id ip = hcloud_server_network.worker[count.index].ip # Wait the control-plane to be initialized, and re-join the new cluster if the # control-plane server changed. - control_id = null_resource.k3sup_control.id + control_id = terraform_data.k3sup_control.id } connection { @@ -105,7 +105,7 @@ resource "null_resource" "k3sup_worker" { # Configure kubernetes data "local_sensitive_file" "kubeconfig" { - depends_on = [null_resource.k3sup_control] + depends_on = [terraform_data.k3sup_control] filename = local.kubeconfig_path } diff --git a/providers.tf b/providers.tf index 525aa13..4248692 100644 --- a/providers.tf +++ b/providers.tf @@ -4,10 +4,6 @@ terraform { source = "hashicorp/local" version = ">= 2.5.1, < 3.0.0" } - null = { - source = "hashicorp/null" - version = ">= 3.2.2, < 4.0.0" - } tls = { source = "hashicorp/tls" version = ">= 4.0.5, < 5.0.0" From ca136bd43442b98b59a632aea3e8416516cf1890 Mon Sep 17 00:00:00 2001 From: jo Date: Mon, 9 Dec 2024 12:26:08 +0100 Subject: [PATCH 2/2] update lock file --- example/.terraform.lock.hcl | 141 ++++++++++++++++++------------------ 1 file changed, 69 insertions(+), 72 deletions(-) diff --git a/example/.terraform.lock.hcl b/example/.terraform.lock.hcl index 8352312..ba32159 100644 --- a/example/.terraform.lock.hcl +++ b/example/.terraform.lock.hcl @@ -2,98 +2,95 @@ # Manual edits may be lost in future updates. provider "registry.opentofu.org/hashicorp/helm" { - version = "2.14.1" - constraints = "2.14.1" + version = "2.16.1" + constraints = ">= 2.14.1, < 3.0.0" hashes = [ - "h1:WB6ahIjX1hgmeB8Edn6AAImw5LrOvPxJP7pi0KhhEz0=", - "zh:3e0c73080563611451e7de1b5c28ce945da7027aac619df6506f8d5c420ba2d4", - "zh:5b8760f2b9798cf3160a4db4001463a3f1001359c74a6ef601a81bfbc4c4bd74", - "zh:64ab4ad0e650e717bf5932717a94b6f6be790b6f7f93b51da371c3383933e233", - "zh:7173f961833c564d83ed4994aaaefa7be849c2a63bbac3cd288ccf3be763ca21", - "zh:7ffce2dd580e15b98e0f2601d1da3bf8b4adeabe4c4de513f67f480871e0c594", - "zh:962433200cefbb96d009c1fa858e4a3068926ba85de60fa0a0cf321ce7e26697", - "zh:aba9b11d9e48a18fd3290f164ae4748d44f2a734402bc48b86a140edd64a60cd", - "zh:b9f7080226ab201cd80c8a1e6f5e5bb6d93cfd84bcf693845d35963933a37012", - "zh:dd1771c46668c1615900ab559a7e4dea552c615f3eff5cf611a85b7ede18bdc8", - "zh:f85abfcfe40475c878a7135e4abbb152454e9dc98b8e2b7b6928e7f9402ad127", + "h1:OAMufKLYnPEyJMNMaOFYQys3HdXtFdaT7kEaWmaINTI=", + "zh:1c820d7997377c80c320b3bb4f257258af6c499bf2f2082a87975854b156b82b", + "zh:223dc3ba691a03eeb32d14160b3c6adc77d55a767274c728250cd4f1d4238a2a", + "zh:332095747133eb558da1455056f993314b16346d46065967ffe5f7b243614591", + "zh:46155a04e08e9790e22cb7b70d83cdf908e36121597c801a9300f8c100f1ad01", + "zh:51974f6ceb6b4c2aa575384a0cc1fbad22b8b868558e969a196575d43e9d0198", + "zh:7da302779eb39e63a62a0928e391852054ad83eb2025c190475c94a5afc77d29", + "zh:947bbf2a4d8461ec4a544ef7b76f45815602563123987a63dce843258440aa24", + "zh:b84a6658447bbd46daff26010771f0e2168423f0f7f1c1bc2b4ba53f9e891263", + "zh:dd21fdb13d85467b848682c63f440974cef99472d988794f019630f20ac3d2e6", + "zh:e0f77d2f7cf84d6c0d7f30f6cdc325c319ff4eadd525c6fb6979da62e5ff843d", ] } provider "registry.opentofu.org/hashicorp/kubernetes" { - version = "2.31.0" - constraints = "2.31.0" + version = "2.34.0" + constraints = ">= 2.31.0, < 3.0.0" hashes = [ - "h1:MLk6rnv1ExXguVTT/lMa9VPubPYS6VF9sKBjzaVUASE=", - "h1:z2qlqn6WbrjbezwQo4vvlwAgVUGz59klzDU4rlYhYi8=", - "zh:0dd25babf78a88a61dd329b8c18538a295ea63630f1b69575e7898c89307da39", - "zh:3138753e4b2ce6e9ffa5d65d73e9236169ff077c10089c7dc71031a0a139ff6d", - "zh:644f94692dc33de0bb1183c307ae373efbf4ef4cb92654ccc646a5716edf9593", - "zh:6cc630e43193220b1599e3227286cc4e3ca195910e8c56b6bacb50c5b5176dbf", - "zh:764173875e77aa482da4dca9fec5f77c455d028848edfc394aa7dac5dfed6afd", - "zh:7b1d380362d50ffbb3697483036ae351b0571e93b33754255cde6968e62b839f", - "zh:a1d93ca3d8d1ecdd3b69242d16ff21c91b34e2e98f02a3b2d02c908aeb45189b", - "zh:b471d0ab56dbf19c95fba68d2ef127bdb353be96a2be4c4a3dcd4d0db4b4180a", - "zh:d610f725ded4acd3d31a240472bb283aa5e657ed020395bdefea18d094b8c2bf", - "zh:d7f3ddd636ad5af6049922f212feb24830b7158410819c32073bf81c359cd2fa", + "h1:ii9zWnkeN3QfUFPSKkTi7xp0Vd645twuNP4RCOYlj28=", + "zh:076f2cddac107b8cebae85980801e14cbcab0a95e542b0db47403d881a0b4276", + "zh:1fb388b1e6a8096ebada7557be79734dae95b4d8de2c6668bfd27f1d1182159e", + "zh:32e39913423bc912b5221d29af21681afdf765dc6b21649a5c93ed02ec5b9bc6", + "zh:4fd19efdc085c8216ebda8d73526cbcfc68ce65c5e0b7dc67675f5fa22b2d8c2", + "zh:66017d34ea30aee60db4cca33da5558e62568137342c9f5ce80aca3aa1c45861", + "zh:7157100f26f1c9c1416d4244a9aaf036363ccf5a642507da9a05eee970fcb2b6", + "zh:9454cb468b5524f5e631e436362ee07e00524983a631aaf66110853e59930f49", + "zh:b89017bb25ec6b8eb00218a06e801f82e9b3f0b24dcef34f1934f72dd061a3f5", + "zh:d2f24facf3322b38efdd26f0bed7b8e901b7a8c6432a2d1be46d21da7ce6826e", + "zh:f1421b4baa47f8221bca5fb557df6059dfe7dcac373f797ec5e9690f11c946d7", ] } provider "registry.opentofu.org/hashicorp/local" { - version = "2.5.1" - constraints = "2.5.1" + version = "2.5.2" + constraints = ">= 2.5.1, < 3.0.0" hashes = [ - "h1:87L+rpGao062xifb1VuG9YVFwp9vbDP6G2fgfYxUkQs=", - "h1:GgW5qncKu4KnXLE1ZYv5iwmhSYtTNzsOvJAOQIyFR7E=", - "zh:031c2c2070672b7e78e0aa15560839278dc57fe7cf1e58a617ac13c67b31d5fb", - "zh:1ef64ea4f8382cd538a76f3d319f405d18130dc3280f1c16d6aaa52a188ecaa4", - "zh:422ce45691b2f384dbd4596fdc8209d95cb43d85a82aaa0173089d38976d6e96", - "zh:7415fbd8da72d9363ba55dd8115837714f9534f5a9a518ec42268c2da1b9ed2f", - "zh:92aa22d071339c8ef595f18a9f9245c287266c80689f5746b26e10eaed04d542", - "zh:9cd0d99f5d3be835d6336c19c4057af6274e193e677ecf6370e5b0de12b4aafe", - "zh:a8c1525b389be5809a97f02aa7126e491ba518f97f57ed3095a3992f2134bb8f", - "zh:b336fa75f72643154b07c09b3968e417a41293358a54fe03efc0db715c5451e6", - "zh:c66529133599a419123ad2e42874afbd9aba82bd1de2b15cc68d2a1e665d4c8e", - "zh:c7568f75ba6cb7c3660b69eaab8b0e4278533bd9a7a4c33ee6590cc7e69743ea", + "h1:6lS+5A/4WFAqY3/RHWFRBSiFVLPRjvLaUgxPQvjXLHU=", + "zh:25b95b76ceaa62b5c95f6de2fa6e6242edbf51e7fc6c057b7f7101aa4081f64f", + "zh:3c974fdf6b42ca6f93309cf50951f345bfc5726ec6013b8832bcd3be0eb3429e", + "zh:5de843bf6d903f5cca97ce1061e2e06b6441985c68d013eabd738a9e4b828278", + "zh:86beead37c7b4f149a54d2ae633c99ff92159c748acea93ff0f3603d6b4c9f4f", + "zh:8e52e81d3dc50c3f79305d257da7fde7af634fed65e6ab5b8e214166784a720e", + "zh:9882f444c087c69559873b2d72eec406a40ede21acb5ac334d6563bf3a2387df", + "zh:a4484193d110da4a06c7bffc44cc6b61d3b5e881cd51df2a83fdda1a36ea25d2", + "zh:a53342426d173e29d8ee3106cb68abecdf4be301a3f6589e4e8d42015befa7da", + "zh:d25ef2aef6a9004363fc6db80305d30673fc1f7dd0b980d41d863b12dacd382a", + "zh:fa2d522fb323e2121f65b79709fd596514b293d816a1d969af8f72d108888e4c", ] } provider "registry.opentofu.org/hashicorp/tls" { - version = "4.0.5" - constraints = "4.0.5" + version = "4.0.6" + constraints = ">= 4.0.5, < 5.0.0" hashes = [ - "h1:LWGTWAUrC+/iTsNq0vxANvGOp+7Jnl4wAnSOW2Shqjc=", - "h1:zEH0OgSkeXDqNWzmOUWDczrUwyyujAHvnbW79qdxVMI=", - "zh:05a7dc3ac92005485714f87541ad6d0d478988b478c5774227a7d39b01660050", - "zh:547e0def44080456169bf77c21037aa6dc9e7f3e644a8f6a2c5fc3e6c15cf560", - "zh:6842b03d050ae1a4f1aaed2a2b1ca707eae84ae45ae492e4bb57c3d48c26e1f1", - "zh:6ced0a9eaaba12377f3a9b08df2fd9b83ae3cb357f859eb6aecf24852f718d9a", - "zh:766bcdf71a7501da73d4805d05764dcb7c848619fa7c04b3b9bd514e5ce9e4aa", - "zh:84cc8617ce0b9a3071472863f43152812e5e8544802653f636c866ef96f1ed34", - "zh:b1939e0d44c89315173b78228c1cf8660a6924604e75ced7b89e45196ce4f45e", - "zh:ced317916e13326766427790b1d8946c4151c4f3b0efd8f720a3bc24abe065fa", - "zh:ec9ff3412cf84ba81ca88328b62c17842b803ef406ae19152c13860b356b259c", - "zh:ff064f0071e98702e542e1ce00c0465b7cd186782fe9ccab8b8830cac0f10dd4", + "h1:EJoUGDo7L52Iu22cA1KCndJ9B1Rrfd75wyZzsScEnc0=", + "zh:4b53b372767e5068d9bbfc89199201c1ae4283dde2f0c301974f8abb4215791f", + "zh:5b4c308bd074c6d0bd560220e6ee10a9859ca9a1f29a59367b0477a740ff265e", + "zh:674dd6bc85597677e160ee601d88b21c5a974759a658769812d2904bd94bc042", + "zh:6ccc1c448349b56677ba66112aec7e0a58eb827f66209ca5f4077b81cce240fb", + "zh:8aa6e13a5d722b74230937ea21e8b4994e53340d95b5691cf6cf3518b9f38e6e", + "zh:8b27e55e4c7fa887774860113b95c8f7f68804b002fa47f0eb8e3a485997287e", + "zh:a430b5a3e8753d8f61784de49e538ac4abed19fb665fccd8a10b55402fe9f076", + "zh:b07c978c335ae9fc12f9c221629610775e4ae36691ed4e7ba258d275dd58a243", + "zh:bbec8cb1efc84ee3026c793956a4a4cd0ece20b89d2d4f7d954c68e7f6d596d0", + "zh:e684e247424188dc3b500a543b1a8046d1c0ec08c2a90aedca0c4f6bb56bedbd", ] } provider "registry.opentofu.org/hetznercloud/hcloud" { - version = "1.48.0" - constraints = "1.48.0" + version = "1.49.1" + constraints = ">= 1.48.0, < 2.0.0" hashes = [ - "h1:pdeMfdZHftUivK+TGABJI4fnRHvF0GFbCGWxh+uL+94=", - "zh:19d38d046e26153edcdd36ce8c0e16198aa9dea5186559651c4a75c455390573", - "zh:3cb7c453067bcabed68275f812100685fc2f753f37c0e620d3358e642833b5f0", - "zh:42cabdbb55dba02816be8d9d3fc30f51d610516cc54c3f057e6bb3ffc960b550", - "zh:486aaa88c6c9af37f07ffea4b54a7dbd11e9faee09f4ed3f2dbcb2d94064427a", - "zh:69b1a9dc867d9beac752f42501f465ea22d3fbc8af8b3a7190b6aa50fcc0db51", - "zh:7422b2ec1188d9e70c3ee34ff201eb12809c0602a009224f7cea6940cce64567", - "zh:7e31665f004a4d0055f0b1b0c0f4d36039c11bb789fc7c07fc9fb54d0d38d751", - "zh:866eb35b5ca82566f7793ec88dc135c6476f33ea0f7a7f10be9768ba3408e791", - "zh:961efe244a5163a3369817bdd1092aae2e58391d7e21929fab56473d62385d1d", - "zh:a08a965235e6db0233730b93a024e2b8a8c1567dd453eb0aa4aec59b9ed91558", - "zh:c031636938f665629ef3d48d771b6037571ddb886366ade241ed19551aaea24f", - "zh:cf8fc251e4ae701d5f2503f5d1b9f7e5f804f676a1b9b2d88a59930d6b7a9054", - "zh:d5fa2cc80a6361d92c5c725f677f93de5d98c9d644ac978f083a06a7381dda1d", - "zh:ecef5c1e59d1c6cde6aee407b79aecd76d6c129dcec4f67666085f0403a0f46a", + "h1:FKGRNHVbcfQJd8EWrb8Ze5QHkaGr8zI+ZKxBMjvOwPk=", + "zh:3d5f9773da4f8203cf625d04a5a0e4ff7e202684c010a801a945756140c61cde", + "zh:446305d492017cda91e5c15122ec16ff15bfe3ef4d3fd6bcea0cdf7742ab1b86", + "zh:44d4f9156ed8b4f0444bd4dc456825940be49048828565964a192286d28c9f20", + "zh:492ad893d2f89bb17c9beb877c8ceb4a16caf39db1a79030fefeada6c7aa217f", + "zh:68dc552c19ad9d209ec6018445df6e06fb77a637513a53cc66ddce1b024082be", + "zh:7492495ffda6f6c49ab38b539bd2eb965b1150a63fb6b191a27dec07d17601cb", + "zh:850fe92005981ea00db86c3e49ba5b49732fdf1f7bd5530a68f6e272847059fc", + "zh:8cb67f744c233acfb1d68a6c27686315439d944edf733b95f113b4aa63d86713", + "zh:8e13dac46e8c2497772ed1baee701b1d1c26bcc95a63b5c4566c83468f504868", + "zh:c44249c6a8ba931e208a334792686b5355ab2da465cadea03c1ea8e73c02db12", + "zh:d103125a28a85c89aea0cb0c534fe3f504416c4d4fc75c37364b9ec5f66dd77d", + "zh:ed8f64e826aa9bfca95b72892271678cb78411b40d7b404a52404141e05a4ab1", + "zh:f40efad816de00b279bd1e2cbf62c76b0e5b2da150a0764f259984b318e30945", + "zh:f5e912d0873bf4ecc43feba4ceccdf158048080c76d557e47f34749139fdd452", ] }