Skip to content

Commit

Permalink
refactor: not having hetzner token usage
Browse files Browse the repository at this point in the history
  • Loading branch information
dd84ai committed Jan 2, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent f8e7bc7 commit 2d7a8f0
Showing 4 changed files with 6 additions and 36 deletions.
11 changes: 1 addition & 10 deletions tf/production/main.tf
Original file line number Diff line number Diff line change
@@ -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"]
}

12 changes: 2 additions & 10 deletions tf/production/providers.tf
Original file line number Diff line number Diff line change
@@ -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" {
7 changes: 1 addition & 6 deletions tf/staging/main.tf
Original file line number Diff line number Diff line change
@@ -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"]
}

12 changes: 2 additions & 10 deletions tf/staging/providers.tf
Original file line number Diff line number Diff line change
@@ -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" {

0 comments on commit 2d7a8f0

Please sign in to comment.