title: Terraform: how to get elements from a data type
body: <p>i have an unusual issue with terraform.</p>
  
  <p>i create two VPCs and within the same terraform script i want to add a private hosted zone.</p>
  
  <p>i do the following:
  <code>data "aws_vpcs" "foo" {}</code>
  this is getting me the VPCs that are created in the region.</p>
  
  <p>normally i can output the IDs of the VPCs like:</p>
  
  <pre><code>output "test" {
    value = data.aws_vpcs.foo.ids
  }
  </code></pre>
  
  <p>this is giving me a list like: </p>
  
  <p>[
      "vpc-0c8446a2164b7d0af",
      "vpc-0e7c63c3f383d115d",
  ]</p>
  
  <p>now, from this list i would like to get the 1st VPC id: "vpc-0c8446a2164b7d0af"</p>
  
  <p>the problem is that it does not work. 
  i try using the element function like:
  <code>element(data.aws_vpcs.foo.ids, 0)</code>
  <code>element([data.aws_vpcs.foo.ids], 0)</code></p>
  
  <p>i also try to assign this to a value like: data.aws_vpcs.foo.ids[0]</p>
  
  <p>it does not work and i cannot find any other options on terraform to help me solve this.</p>
  
  <p>i want to use the 1st VPC id to create a resource:</p>
  
  <pre><code>resource "aws_route53_zone" "private" {
   name = "example.com"
  
   vpc {
     vpc_id = data.aws_vpcs.foo.ids[0]
     }
  }
  </code></pre>
  
  <p>so i can get the 1st VPC (it does not matter the order) from the List of VPCs i get in the region.</p>
  
  <p>when i run terraform plan i get the error:</p>
  
  <pre><code>Error: Invalid index
  
   on main.tf line 25, in resource "aws_route53_zone" "private":
   25:     vpc_id = data.aws_vpcs.foo.ids[0]
  
  This value does not have any indices.
  </code></pre>