title: Getting length of list from Terraform Map
body: <p>I currently have this map in a test.tfvars file:</p>
  
  <pre><code>ssm = {
      names = ["Terraform-1","Terraform-2","Terraform-3"]
      values = ["tf-1","tf-2","tf-3"]
  }
  </code></pre>
  
  <p>And what I want to do is the following:</p>
  
  <pre><code>resource "aws_ssm_parameter" "parameter_store" {
    count = 3
    name = "$${element(var.ssm[names],count.index)}"
    type = "String"
    value = "$${element(var.ssm[values],count.index)}"
  }
  </code></pre>
  
  <p>But instead of count=3, I would like the count to be based off of the length of the names list from my ssm map. I've tried this:</p>
  
  <pre><code>"${length(var.ssm[names])}"
  </code></pre>
  
  <p>But I'm getting the error: </p>
  
  <pre><code>Error: aws_ssm_parameter.parameter_store: resource count can't reference variable: names
  </code></pre>
  
  <p>Can anyone point me in the right direction with solving this error? I'm not too sure what I'm doing wrong.</p>