Skip to content

Commit

Permalink
refactor: to pass storage
Browse files Browse the repository at this point in the history
  • Loading branch information
dd84ai committed Jul 29, 2024
1 parent e172891 commit d20f99f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
6 changes: 5 additions & 1 deletion tf/production/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ data "aws_ssm_parameter" "darkbot" {
name = "/terraform/hetzner/darkbot/production"
}

data "external" "secrets_darkbot" {
program = ["pass", "api/personal/terraform/hetzner/darkbot/production"]
}

locals {
secrets = nonsensitive(jsondecode(data.aws_ssm_parameter.darkbot.value))
secrets = nonsensitive(data.external.secrets_darkbot.result)
}

provider "docker" {
Expand Down
8 changes: 4 additions & 4 deletions tf/production/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ terraform {
}
}

data "external" "pass_storage" {
program = ["bash", "${path.module}/pass_storage.sh"]
data "external" "secrets_providers" {
program = ["bash", "${path.module}/secrets_providers.sh"]
}

provider "hcloud" {
token = data.external.pass_storage.result["hetzner_token"]
token = data.external.secrets_providers.result["hetzner_token"]
}

provider "cloudflare" {
api_token = data.external.pass_storage.result["cloudflare_token"]
api_token = data.external.secrets_providers.result["cloudflare_token"]
}

provider "kubernetes" {
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions tf/staging/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ module "server" {
name = "node-arm"
}

data "aws_ssm_parameter" "darkbot" {
name = "/terraform/hetzner/darkbot/staging"
data "external" "secrets_darkbot" {
program = ["pass", "api/personal/terraform/hetzner/darkbot/staging"]
}

locals {
secrets = nonsensitive(jsondecode(data.aws_ssm_parameter.darkbot.value))
secrets = nonsensitive(data.external.secrets_darkbot.result)
}

provider "docker" {
Expand Down
8 changes: 4 additions & 4 deletions tf/staging/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ terraform {
}
}

data "external" "pass_storage" {
program = ["bash", "${path.module}/pass_storage.sh"]
data "external" "secrets_providers" {
program = ["bash", "${path.module}/secrets_providers.sh"]
}

provider "hcloud" {
token = data.external.pass_storage.result["hetzner_token"]
token = data.external.secrets_providers.result["hetzner_token"]
}

provider "cloudflare" {
api_token = data.external.pass_storage.result["cloudflare_token"]
api_token = data.external.secrets_providers.result["cloudflare_token"]
}

provider "kubernetes" {
Expand Down
File renamed without changes.

0 comments on commit d20f99f

Please sign in to comment.