Skip to content

Commit

Permalink
feat: get rid of self reference for the node_configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
aldor007 committed Jul 24, 2024
1 parent 596da7c commit 4ca426f
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 @@ -31,7 +31,7 @@ resource "castai_node_configuration" "this" {

resource "castai_node_configuration_default" "this" {
cluster_id = castai_gke_cluster.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_node_template" "this" {
Expand All @@ -40,7 +40,7 @@ resource "castai_node_template" "this" {
cluster_id = castai_gke_cluster.castai_cluster.id

name = try(each.value.name, each.key)
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)
is_default = try(each.value.is_default, false)
is_enabled = try(each.value.is_enabled, true)
should_taint = try(each.value.should_taint, true)
Expand Down
7 changes: 7 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,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 4ca426f

Please sign in to comment.