title: Extract Values from terraform map variable
body: <p>I am trying to extract the values from map variable based on certain conditions as below :-</p>
  
  <pre><code>    Variables.tf File content
      variable "users" {
      type = "map"
      default = {
      "101" = "abc@gmail.com"
      "102" = "def@gmail.com"
      "103" = "xyz@gmail.com"
      "104" = "klm@gmail.com"
      "105" = "pqr@gmail.com"
      "106" = "tuv@gmail.com"
       }
     }
  </code></pre>
  
  <p>Below is my main.tf file</p>
  
  <pre><code>    module "instance" {
      instance_private_ip = ["11.12.13.x"]
      dns_map = ["y"]
      users = ["z"]
      }
  
      module "instance2" {
      instance_private_ip = ["11.12.14.a"]
      dns_map = ["b"]
      users = ["c"]
      }
  </code></pre>
  
  <p>The value <strong>x</strong> should be all even numbers in users variables like - <strong>102, 104 and so on.</strong> 
  The value <strong>y</strong> should be same as <strong>x</strong>
  The value <strong>z</strong> should be corresponding to <strong>x and y</strong>.
  The value <strong>a</strong> should be all even numbers in users variables like - <strong>101, 103 and so on.</strong> 
  The value <strong>b</strong> should be same as <strong>a</strong>
  The value <strong>c</strong> should be corresponding to <strong>a and b</strong>. Example as below</p>
  
  <pre><code>module "instance" {
      instance_private_ip = ["11.12.13.102", "11.12.13.104", "11.12.13.106"]
      dns_map = ["102","104","106"]
      users = ["def@gmail.com","klm@gmail.com","tuv@gmail.com"]
      }
  module "instance2" {
      instance_private_ip = ["11.12.14.101", "11.12.14.103", "11.12.14.105"]
      dns_map = ["101","103","105"]
      users = ["abc@gmail.com","xyz@gmail.com","pqr@gmail.com"]
      }
  </code></pre>
  
  <p>I am trying with ${element(var.notebook[count.index])} but it will give me the username and not the left side variable.</p>
  
  <p>Any help is appreciated</p>