From 2d7a8f071771c05328fbc17083e8a4b1e0865a68 Mon Sep 17 00:00:00 2001 From: dd84ai Date: Thu, 2 Jan 2025 08:18:38 +0100 Subject: [PATCH] refactor: not having hetzner token usage --- tf/production/main.tf | 11 +---------- tf/production/providers.tf | 12 ++---------- tf/staging/main.tf | 7 +------ tf/staging/providers.tf | 12 ++---------- 4 files changed, 6 insertions(+), 36 deletions(-) diff --git a/tf/production/main.tf b/tf/production/main.tf index f3c35a4..81b7dcd 100644 --- a/tf/production/main.tf +++ b/tf/production/main.tf @@ -1,12 +1,3 @@ -module "ssh_key" { - source = "../../../infra/tf/modules/hetzner_ssh_key/data" -} - -module "server" { - source = "../../../infra/tf/modules/hetzner_server/data" - name = "node-darklab" -} - data "external" "secrets_darkbot" { program = ["pass", "personal/terraform/hetzner/darkbot/production"] } @@ -16,7 +7,7 @@ locals { } provider "docker" { - host = "ssh://root@${module.server.ipv4_address}:22" + host = "ssh://root@${module.data_cluster.node_darklab.ipv4_address}:22" ssh_opts = ["-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "-i", "~/.ssh/id_rsa.darklab"] } diff --git a/tf/production/providers.tf b/tf/production/providers.tf index c613e57..9a1b806 100644 --- a/tf/production/providers.tf +++ b/tf/production/providers.tf @@ -1,9 +1,5 @@ terraform { required_providers { - hcloud = { - source = "hetznercloud/hcloud" - version = ">=1.45.0" - } cloudflare = { source = "cloudflare/cloudflare" version = ">=3.7.0" @@ -19,12 +15,8 @@ data "external" "secrets_cloudflare" { program = ["pass", "personal/terraform/cloudflare/dd84ai"] } -data "external" "secrets_hetzner" { - program = ["pass", "personal/terraform/hetzner/production"] -} - -provider "hcloud" { - token = data.external.secrets_hetzner.result["token"] +module "data_cluster" { + source = "../../../infra/tf/production/output/deserializer" } provider "cloudflare" { diff --git a/tf/staging/main.tf b/tf/staging/main.tf index 00b39ce..097ab02 100644 --- a/tf/staging/main.tf +++ b/tf/staging/main.tf @@ -1,8 +1,3 @@ -module "server" { - source = "../../../infra/tf/modules/hetzner_server/data" - name = "node-darklab" -} - data "external" "secrets_darkbot" { program = ["pass", "personal/terraform/hetzner/darkbot/staging"] } @@ -12,7 +7,7 @@ locals { } provider "docker" { - host = "ssh://root@${module.server.ipv4_address}:22" + host = "ssh://root@${module.data_cluster.node_darklab.ipv4_address}:22" ssh_opts = ["-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "-i", "~/.ssh/id_rsa.darklab"] } diff --git a/tf/staging/providers.tf b/tf/staging/providers.tf index 43fabcc..df60196 100644 --- a/tf/staging/providers.tf +++ b/tf/staging/providers.tf @@ -1,9 +1,5 @@ terraform { required_providers { - hcloud = { - source = "hetznercloud/hcloud" - version = ">=1.35.2" - } aws = { source = "hashicorp/aws" version = ">=2.7.0" @@ -26,12 +22,8 @@ data "external" "secrets_cloudflare" { program = ["pass", "personal/terraform/cloudflare/dd84ai"] } -data "external" "secrets_hetzner" { - program = ["pass", "personal/terraform/hetzner/production"] -} - -provider "hcloud" { - token = data.external.secrets_hetzner.result["token"] +module "data_cluster" { + source = "../../../infra/tf/production/output/deserializer" } provider "cloudflare" {