title: Attach network interface device to ec2 instance AWS via Terraform
body: <p>I am trying to attach network interface device in Terraform. I have tried testing with the code below but when creating an instance, AWS already makes an eni, before you attach anything.</p>
  
  <p>So when you attach something, you will end up with a second eni. I need only one primary private IP and it results in 2 private IPs.</p>
  
  <pre><code>resource "aws_network_interface" "test" {
    subnet_id = "${aws_subnet.public_a.id}"
    private_ips = ["10.0.0.50"]
    security_groups = ["${aws_security_group.web.id}"]
    attachment {
      instance = "${aws_instance.test.id}"
      device_index = 1
    }
  }
  </code></pre>