Skip to content

Commit

Permalink
feat: get rid of self reference for the node_configuration - KUBE-488
Browse files Browse the repository at this point in the history
  • Loading branch information
aldor007 committed Aug 13, 2024
1 parent eb89712 commit 2cd23ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ resource "castai_node_configuration" "this" {

resource "castai_node_configuration_default" "this" {
cluster_id = castai_aks_cluster.castai_cluster.id
configuration_id = length(regexall(local.configuration_id_regex_pattern, var.default_node_configuration)) > 0 ? var.default_node_configuration : castai_node_configuration.this[var.default_node_configuration].id
configuration_id = var.default_node_configuration_name != "" ? castai_node_configuration.this[var.default_node_configuration_name].id : length(regexall(local.configuration_id_regex_pattern, var.default_node_configuration)) > 0 ? var.default_node_configuration : castai_node_configuration.this[var.default_node_configuration].id

depends_on = [castai_node_configuration.this]
}
Expand All @@ -63,7 +63,7 @@ resource "castai_node_template" "this" {
name = try(each.value.name, each.key)
is_default = try(each.value.is_default, false)
is_enabled = try(each.value.is_enabled, true)
configuration_id = can(each.value.configuration_id) ? length(regexall(local.configuration_id_regex_pattern, each.value.configuration_id)) > 0 ? each.value.configuration_id : castai_node_configuration.this[each.value.configuration_id].id : null
configuration_id = try(each.value.configuration_name, null) != null ? castai_node_configuration.this[each.value.configuration_name] : can(each.value.configuration_id) ? length(regexall(local.configuration_id_regex_pattern, each.value.configuration_id)) > 0 ? each.value.configuration_id : castai_node_configuration.this[each.value.configuration_id].id : null
should_taint = try(each.value.should_taint, true)
rebalancing_config_min_nodes = try(each.value.rebalancing_config_min_nodes, 0)

Expand Down
7 changes: 7 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ variable "node_configurations" {
variable "default_node_configuration" {
type = string
description = "ID of the default node configuration"
default = ""
}

variable "default_node_configuration_name" {
type = string
description = "Name of the default node configuration"
default = ""
}

variable "node_templates" {
Expand Down

0 comments on commit 2cd23ba

Please sign in to comment.