Skip to content

Commit

Permalink
Helm release dynamic set blocks. (#48)
Browse files Browse the repository at this point in the history
* Update variables.tf

Add new variable to handle dynamic sets on all helm_release resources.

* Update main.tf

Add dynamic set blocks for custom settings to helm_release resources (i.e. tolerations).
  • Loading branch information
jhunter1-onetrust authored Jan 9, 2024
1 parent 9cce63a commit d2abc15
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
48 changes: 48 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ resource "helm_release" "castai_agent" {
}
}

dynamic "set" {
for_each = var.castai_components_sets
content {
name = set.key
value = set.value
}
}

set_sensitive {
name = "apiKey"
value = castai_aks_cluster.castai_cluster.cluster_token
Expand Down Expand Up @@ -168,6 +176,14 @@ resource "helm_release" "castai_evictor" {
}
}

dynamic "set" {
for_each = var.castai_components_sets
content {
name = set.key
value = set.value
}
}

depends_on = [helm_release.castai_agent]

lifecycle {
Expand Down Expand Up @@ -213,6 +229,14 @@ resource "helm_release" "castai_cluster_controller" {
}
}

dynamic "set" {
for_each = var.castai_components_sets
content {
name = set.key
value = set.value
}
}

set_sensitive {
name = "castai.apiKey"
value = castai_aks_cluster.castai_cluster.cluster_token
Expand Down Expand Up @@ -293,6 +317,14 @@ resource "helm_release" "castai_pod_pinner" {
}
}

dynamic "set" {
for_each = var.castai_components_sets
content {
name = set.key
value = set.value
}
}

set {
name = "replicaCount"
value = "0"
Expand Down Expand Up @@ -343,6 +375,14 @@ resource "helm_release" "castai_spot_handler" {
}
}

dynamic "set" {
for_each = var.castai_components_sets
content {
name = set.key
value = set.value
}
}

set {
name = "castai.clusterID"
value = castai_aks_cluster.castai_cluster.id
Expand Down Expand Up @@ -378,6 +418,14 @@ resource "helm_release" "castai_kvisor" {
name = "structuredConfig.provider"
value = "aks"
}

dynamic "set" {
for_each = var.castai_components_sets
content {
name = set.key
value = set.value
}
}
}

resource "castai_autoscaler" "castai_autoscaler_policies" {
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ variable "castai_components_labels" {
default = {}
}

variable "castai_components_sets" {
type = map(string)
description = "Optional additional 'set' configurations for helm resources."
default = {}
}

variable "node_configurations" {
type = any
description = "Map of AKS node configurations to create"
Expand Down

0 comments on commit d2abc15

Please sign in to comment.