Skip to content

Commit

Permalink
feat: get rid of self reference for the node_configuration (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
aldor007 authored Aug 14, 2024
1 parent 54f7c36 commit 647534b
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 @@ -58,7 +58,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 = try(each.value.configuration_id, null)
configuration_id = try(each.value.configuration_name, null) != null ? castai_node_configuration.this[each.value.configuration_name].id : try(each.value.configuration_id, null)
should_taint = try(each.value.should_taint, true)

custom_labels = try(each.value.custom_labels, {})
Expand Down Expand Up @@ -136,7 +136,7 @@ resource "castai_node_template" "this" {

resource "castai_node_configuration_default" "this" {
cluster_id = castai_eks_cluster.my_castai_cluster.id
configuration_id = var.default_node_configuration
configuration_id = var.default_node_configuration_name != "" ? castai_node_configuration.this[var.default_node_configuration_name].id : var.default_node_configuration
}

resource "castai_workload_scaling_policy" "this" {
Expand Down
7 changes: 7 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,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 647534b

Please sign in to comment.