title: Terraform, convert user input variable to type list
body: <p>In Terraform, I want a user to enter values for a variable (type list) without having to worry too much about the syntax for a list variable. For example, Terraform requires the following syntax for lists:</p>
  
  <pre><code>Enter value: ["value1", "value2", "value3"]
  </code></pre>
  
  <p>It would be nice if the user just needed to enter a comma separated list without having to worry about adding quotations and the brackets.  For example:</p>
  
  <pre><code>Enter value: value1, value2, value3
  </code></pre>
  
  <p>From the comma separated string, I would like to convert it to type list with the correct syntax.</p>
  
  <p>My current code looks like this, I don't think I am even close to figuring it out.  Any help is appreciated!</p>
  
  <pre><code>variable "subnetNames" {
     description = "Enter value:"
     default     = "value1, value2, value3"
  }
  
  
  output "test" {
    value = "${join(",", list("[", var.subnetNames, "]"))}"
  }
  </code></pre>