terraform-aws-eks-node-group icon indicating copy to clipboard operation
terraform-aws-eks-node-group copied to clipboard

after_cluster_joining_userdata only allows one element

Open jchanam opened this issue 3 years ago • 1 comments

Describe the Bug

The validation of the variable after_cluster_joining_userdata expects the length of the array to be smaller than 2, but the definition says that it can contain commands in plural.

variable "after_cluster_joining_userdata" {
  type        = list(string)
  default     = []
  description = "Additional `bash` commands to execute on each worker node after joining the EKS cluster (after executing the `bootstrap.sh` script). For more info, see https://kubedex.com/90-days-of-aws-eks-in-production"
  validation {
    condition = (
      length(var.after_cluster_joining_userdata) < 2
    )
    error_message = "You may not specify more than one `after_cluster_joining_userdata`."
  }
}

Expected Behavior

The variable to be a string or the validation to allow more than 1 element.

jchanam avatar Jul 21 '22 12:07 jchanam

@jchanam Sorry if this is confusing, but it follows the pattern that optional data is provided in a list of zero or one items. The userdata can be a multi-line string:

  after_cluster_joining_userdata  = [<<-EOT
    # After joining the cluster, execute a couple of commands
    echo foo
    echo bar
    EOT
  ]

Nuru avatar Aug 17 '22 20:08 Nuru

Closing due to no response after recommending a solution.

Nuru avatar Aug 02 '23 23:08 Nuru