Skip to content

Commit

Permalink
parameterize helm release
Browse files Browse the repository at this point in the history
  • Loading branch information
erjondibranica committed Jul 26, 2024
1 parent 88822f3 commit e0129e2
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
20 changes: 18 additions & 2 deletions modules/otc-prometheus-exporter/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

resource "helm_release" "otc-prometheus-exporter" {
name = var.release_name
repository = "https://iits-consulting.github.io/otc-prometheus-exporter/"
chart = "otc-prometheus-exporter"
repository = var.chart_repository
chart = var.chart_name
version = var.release_version

namespace = var.release_namespace
Expand All @@ -13,6 +14,21 @@ resource "helm_release" "otc-prometheus-exporter" {
dependency_update = true
wait_for_jobs = true

dynamic "set" {
for_each = toset(var.chart_set_parameter)
content {
name = set.value.name
value = set.value.value
}
}
dynamic "set_sensitive" {
for_each = toset(var.chart_set_sensitive_parameter)
content {
name = set_sensitive.value.name
value = set_sensitive.value.value
}
}

values = [yamlencode({
deployment = {
env = {
Expand Down
33 changes: 33 additions & 0 deletions modules/otc-prometheus-exporter/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,36 @@ variable "release_version" {
type = string
description = "Release version of the chart (see releases on https://github.com/iits-consulting/otc-prometheus-exporter/tree/gh-pages)"
}



variable "chart_repository" {
type = string
default = "https://iits-consulting.github.io/otc-prometheus-exporter/"
description = "Chart repository of the IITS otc-prometheus-exporter chart."
}


variable "chart_name" {
type = string
default = "otc-prometheus-exporter"
description = "Name of the IITS otc-prometheus-exporter chart."
}

variable "chart_set_parameter" {
type = list(object({
name = string
value = string
}))
default = []
description = "Override the values of the IITS otc-prometheus-exporter chart using set."
}

variable "chart_set_sensitive_parameter" {
type = list(object({
name = string
value = string
}))
default = []
description = "Override the values of the IITS otc-prometheus-exporter chart using set_sensitive."
}

0 comments on commit e0129e2

Please sign in to comment.