title: How to create a map in terraform
body: <p>I'm confused on how to get this working, I have a sub-domian (module.foo.dev) and alternate domain name as *.foo.dev but it has to use the same zone_id as my root_domain.</p>
  <p>I'm trying to use a local map something like</p>
  <pre><code>all_domains = {
    [&quot;module.foo.dev&quot;,&quot;*.foo.dev&quot;] = &quot;foo.dev&quot;
    [&quot;bar.com&quot;] = &quot;bar.com&quot;
  }
  </code></pre>
  <p>My variables are as follows
  primary_domain = &quot;module.foo.dev&quot;
  sub_alternate_domain = [&quot;*.foo.dev&quot;,&quot;bar.com&quot;]</p>
  <p>Eventually would be using that locals value in the below module
  module:</p>
  <pre><code>resource &quot;aws_route53_record&quot; &quot;record&quot; {
  
    count      = var.validation_method == &quot;DNS&quot; ? local.all_domains : 0
    name       = aws_acm_certificate.certificate.domain_validation_options.0.resource_record_name
    type       = aws_acm_certificate.certificate.domain_validation_options.0.resource_record_type
    zone_id    = data.aws_route53_zone.selected[count.index].zone_id
    ttl        = &quot;300&quot;
    records    = [aws_acm_certificate.certificate.domain_validation_options.0.resource_record_value]
  
  }
  </code></pre>
  <p>Can someone pls help me with this solution..</p>