title: terraform var output to pick from a map element in list of maps
body: <p>I have an output like this:</p>
  
  <pre><code>output "esxi_gw_ip" {
    value = "${packet_device.esxi.network}"
  }
  </code></pre>
  
  <p>and the result is this:</p>
  
  <pre><code>       "outputs": {
                  "esxi_gw_ip": {
                      "sensitive": false,
                      "type": "list",
                      "value": [
                          {
                              "address": "139.0.0.2",
                              "cidr": "29",
                              "family": "4",
                              "gateway": "139.0.0.1",
                              "public": "1"
                          },
                          {
                              "address": "blah",
                              "cidr": "127",
                              "family": "6",
                              "gateway": "blah",
                              "public": "1"
                          },
                          {
                              "address": "10.88.94.2",
                              "cidr": "29",
                              "family": "4",
                              "gateway": "10.88.94.1",
                              "public": "0"
                          }
                      ]
                  }
  </code></pre>
  
  <p>I want to get the gateway from <code>family = 4</code> and <code>public = 1</code>...how can I do that? I can get the first from the list like this and then use something like <code>jq</code> in <code>local-exec</code>:</p>
  
  <pre><code>output "esxi_gw_ip" {
    value = "${packet_device.esxi.network[0]}"
  }
  </code></pre>
  
  <p>but that doesn't have any guarantees that it'll always being <code>0</code> and I'm also trying to do this natively in terraform vs using shell...</p>