Skip to content
Snippets Groups Projects
Commit 8c441430 authored by Andri Joos's avatar Andri Joos :blush:
Browse files

add generalization file

parent e31c6e08
No related branches found
No related tags found
No related merge requests found
terraform {
required_providers {
helm = {
source = "hashicorp/helm"
version = "~> 2.17"
}
}
}
resource "helm_release" "this" {
name = var.release_name
repository = var.chart_repo
chart = var.chart_name
version = var.chart_version
namespace = var.namespace
create_namespace = var.create_namespace
wait = var.wait
values = local.values_content
dynamic "set" {
for_each = local.set_values
content {
name = set.key
value = set.value
}
}
dynamic "set_sensitive" {
for_each = local.set_sensitive_values
content {
name = set_sensitive.key
value = set_sensitive.value
}
}
}
variable "chart_name" {
description = "Name of the Helm chart"
type = string
}
variable "chart_repo" {
description = "URL of the Helm chart repository"
type = string
}
variable "chart_version" {
description = "Version of the Helm chart"
type = string
}
variable "release_name" {
description = "Name of the Helm release"
type = string
}
variable "namespace" {
description = "Kubernetes namespace for the release"
type = string
}
variable "create_namespace" {
description = "Create Kubernetes namespace if it doesn't exist"
type = bool
default = true
}
variable "wait" {
description = "Wait for the Helm chart to be applied"
type = bool
default = true
}
variable "default_values_files" {
description = "Custom values files for the Helm chart"
type = list(string)
default = []
}
variable "extra_values_files" {
description = "Custom values files for the Helm chart"
type = list(string)
default = []
}
variable "default_set_values" {
description = "Map of values to set"
type = map(string)
default = {}
}
variable "extra_set_values" {
description = "Map of values to set"
type = map(string)
default = {}
}
variable "default_set_sensitive_values" {
description = "Map of sensitive values to set"
type = map(string)
default = {}
}
variable "extra_set_sensitive_values" {
description = "Map of sensitive values to set"
type = map(string)
default = {}
}
locals {
values_files = concat(var.default_values_files, var.extra_values_files)
values_content = [for file_path in local.values_files : file(file_path)]
set_values = merge(var.default_set_values, var.extra_set_values)
set_sensitive_values = merge(var.default_set_sensitive_values, var.extra_set_sensitive_values)
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment