title: Terraform ebs volume
body: <p>I am new to terraform,  have created 3 ec2 instances, and i have created 6 ebs volume. How do we attach 2 ebs volumes to each of the three instances? </p>
  
  <pre><code>#Create 6 EBS volumes and attach 2 per instance.
  resource "aws_ebs_volume" "vertica_ebs" {
          count                           = "6"
          availability_zone               = "${var.availability_zone}"
          size                            = "500"
          type                            = "st1"
  
         }
      }
  
  #Attach ebs volume
  resource "aws_volume_attachment" "ebs_att" {
       count = "6"
  volume {
       device_name = "/dev/sdf"
       volume_id = "[${element(aws_ebs_volume.vertica_ebs.*.id, count.index)}]"
  }
  volume{
       device_name = "/dev/sdg"
       volume_id = "[${element(aws_ebs_volume.vertica_ebs.*.id, count.index)}]"
  }
       instance_id = "[${element(aws_instance.vertica1.*.id,count.index)}]"
  }
  </code></pre>
  
  <p>Errors:</p>
  
  <ul>
  <li>aws_volume_attachment.ebs_att #2: "device_name": required field is not set</li>
  <li>aws_volume_attachment.ebs_att #2: "volume_id": required field is not set</li>
  <li>aws_volume_attachment.ebs_att #2: : invalid or unknown key: volume</li>
  <li>aws_volume_attachment.ebs_att #4: "device_name": required field is not set</li>
  <li>aws_volume_attachment.ebs_att #4: "volume_id": required field is not set</li>
  <li>aws_volume_attachment.ebs_att #4: : invalid or unknown key: volume</li>
  <li>aws_volume_attachment.ebs_att #3: "device_name": required field is not set</li>
  <li>aws_volume_attachment.ebs_att #3: "volume_id": required field is not set</li>
  <li>aws_volume_attachment.ebs_att #3: : invalid or unknown key: volume</li>
  <li>aws_volume_attachment.ebs_att #0: "volume_id": required field is not set</li>
  <li>aws_volume_attachment.ebs_att #0: "device_name": required field is not set</li>
  <li>aws_volume_attachment.ebs_att #0: : invalid or unknown key: volume</li>
  <li>aws_volume_attachment.ebs_att #1: "device_name": required field is not set</li>
  <li>aws_volume_attachment.ebs_att #1: "volume_id": required field is not set</li>
  <li>aws_volume_attachment.ebs_att #1: : invalid or unknown key: volume</li>
  <li>aws_volume_attachment.ebs_att #5: "volume_id": required field is not set</li>
  <li>aws_volume_attachment.ebs_att #5: "device_name": required field is not set</li>
  <li>aws_volume_attachment.ebs_att #5: : invalid or unknown key: volume</li>
  </ul>