Skip to content

Commit

Permalink
refactor: re-organzie tf vars (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega authored Nov 9, 2024
1 parent 8df5af9 commit 491edfa
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 34 deletions.
4 changes: 2 additions & 2 deletions bootstrap/stage2/config.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "kubernetes_config_map" "node-config" {
}

data = {
"admin.sk" = "${file("${path.module}/admin.sk")}"
"protocol-parameters.json" = "${file("${path.module}/protocol-parameters.json")}"
"admin.sk" = var.admin_key
"protocol-parameters.json" = var.protocol_parameters
}
}
10 changes: 8 additions & 2 deletions bootstrap/stage2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,14 @@ variable "external_port" {
type = number
}

variable "admin_key_path" {
type = string
variable "admin_key" {
type = string
description = "The admin key in cardano-cli JSON format."
}

variable "protocol_parameters" {
type = string
description = "The protocol parameters in JSON format."
}

variable "admin_addr" {
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/stage2/secret.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resource "kubernetes_secret" "admin_key" {
namespace = var.namespace
}
data = {
"admin.sk" = "${file(var.admin_key_path)}"
"admin.sk" = var.admin_key
}
type = "Opaque"
}
104 changes: 75 additions & 29 deletions playbook/main/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
locals {
namespace = "hydra-doom"
operator_image = "ghcr.io/demeter-run/doom-patrol-operator:sha-ded72a2"
namespace = "hydra-doom"
}

terraform {
Expand All @@ -17,18 +16,6 @@ terraform {
}
}

provider "kubernetes" {
config_path = "~/.kube/config"
config_context = "hydra-doom-dev-cluster"
}

provider "helm" {
kubernetes {
config_path = "~/.kube/config"
config_context = "hydra-doom-dev-cluster"
}
}

resource "kubernetes_namespace" "namespace" {
metadata {
name = local.namespace
Expand All @@ -51,6 +38,63 @@ variable "dmtr_port_name" {
type = string
}

variable "external_domain" {
type = string
description = "The domain prefix that will be used to access the hydra node."
}

variable "operator_image" {
type = string
description = "The image to use for the operator component."
}

variable "hydra_node_image" {
type = string
description = "The Docker image to use for the Hydra node component."
}

variable "sidecar_image" {
type = string
description = "The Docker image to use for the sidecar component of the Hydra node."
}

variable "open_head_image" {
type = string
description = "The Docker image to use for the open head component of the Hydra node."
}

variable "control_plane_image" {
type = string
description = "The Docker image to use for the control plane component of the Hydra node."
}

variable "hydra_scripts_tx_id" {
type = string
description = "The transaction ID of the Hydra scripts."
}

variable "admin_addr" {
type = string
description = "The address of the admin key."
}

variable "eks_cluster_arn" {
type = string
description = "The ARN of the EKS cluster."
}

provider "kubernetes" {
config_path = "~/.kube/config"
config_context = var.eks_cluster_arn
}

provider "helm" {
kubernetes {
config_path = "~/.kube/config"
config_context = var.eks_cluster_arn
}
}

module "stage1" {
source = "../../bootstrap/stage1/"
}
Expand All @@ -59,19 +103,21 @@ module "stage2" {
source = "../../bootstrap/stage2"
depends_on = [module.stage1]

namespace = local.namespace
external_domain = "us-east-1.hydra-doom.sundae.fi"
operator_image = local.operator_image
hydra_node_image = "ghcr.io/cardano-scaling/hydra-node:latest"
sidecar_image = "ghcr.io/demeter-run/doom-patrol-hydra:477d1ca9081693999580b2b7827df2fc87bb4cb8"
open_head_image = "ghcr.io/demeter-run/doom-patrol-hydra:477d1ca9081693999580b2b7827df2fc87bb4cb8"
control_plane_image = "ghcr.io/demeter-run/doom-patrol-hydra:477d1ca9081693999580b2b7827df2fc87bb4cb8"
blockfrost_key = var.blockfrost_key
external_port = 80
admin_key_path = "${path.module}/admin.sk"
admin_addr = "addr_test1vpgcjapuwl7gfnzhzg6svtj0ph3gxu8kyuadudmf0kzsksqrfugfc"
dmtr_project_id = var.dmtr_project_id
dmtr_api_key = var.dmtr_api_key
dmtr_port_name = var.dmtr_port_name
hydra_scripts_tx_id = "03f8deb122fbbd98af8eb58ef56feda37728ec957d39586b78198a0cf624412a"
admin_key = file("${path.module}/admin.sk")
protocol_parameters = file("${path.module}/protocol-parameters.json")
external_port = 80

namespace = local.namespace
external_domain = var.external_domain
operator_image = var.operator_image
hydra_node_image = var.hydra_node_image
sidecar_image = var.sidecar_image
open_head_image = var.open_head_image
control_plane_image = var.control_plane_image
blockfrost_key = var.blockfrost_key
admin_addr = var.admin_addr
dmtr_project_id = var.dmtr_project_id
dmtr_api_key = var.dmtr_api_key
dmtr_port_name = var.dmtr_port_name
hydra_scripts_tx_id = var.hydra_scripts_tx_id
}
File renamed without changes.

0 comments on commit 491edfa

Please sign in to comment.