Skip to content

Commit

Permalink
Merge pull request #1005 from mrclrchtr/NodepoolNameValidation
Browse files Browse the repository at this point in the history
Add validation for uniqueness of nodepool-names
  • Loading branch information
mysticaltech authored Oct 10, 2023
2 parents 17dd1f9 + 74b11e6 commit d0baebe
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,16 @@ variable "control_plane_nodepools" {
count = number
}))
default = []
validation {
condition = length(
[for control_plane_nodepool in var.control_plane_nodepools : control_plane_nodepool.name]
) == length(
distinct(
[for control_plane_nodepool in var.control_plane_nodepools : control_plane_nodepool.name]
)
)
error_message = "Names in agent_nodepools must be unique."
}
}

variable "agent_nodepools" {
Expand All @@ -169,6 +179,16 @@ variable "agent_nodepools" {
longhorn_volume_size = optional(number)
}))
default = []
validation {
condition = length(
[for agent_nodepool in var.agent_nodepools : agent_nodepool.name]
) == length(
distinct(
[for agent_nodepool in var.agent_nodepools : agent_nodepool.name]
)
)
error_message = "Names in agent_nodepools must be unique."
}
}

variable "cluster_autoscaler_image" {
Expand Down

0 comments on commit d0baebe

Please sign in to comment.