title: generate user_data including "IP Address" while creating ec2 instance using terraform
body: <p>I am trying to spin 2 <code>ec2</code> instances using <code>terraform</code>. Something like this</p>
  
  <pre><code>resource "aws_instance" "example" {
    count                       = "${var.number_of_instances}"
    ami                         = "${var.ami_name}"
    associate_public_ip_address = "${var.associate_public_ip_address}"
    instance_type               = "${var.instance_type}"
    key_name                    = "${var.keyname}"
    subnet_id                   = "${element(var.subnet_ids, count.index)}"
    user_data                   = "${element(data.template_file.example.*.rendered, count.index)}"
    vpc_security_group_ids      = ["${aws_security_group.example.id}","${var.extra_security_group_id}"]
    root_block_device {
      volume_size = "${var.root_volume_size}"
      volume_type = "${var.root_volume_type}"
      iops        = "${var.root_volume_iops}"
    }
    tags {
      Name      = "${var.prefix}${var.name}${format("%02d", count.index + 1)}"
    }
  }
  </code></pre>
  
  <p>In <code>template_file</code> all I am trying to do is to generate a config file with <code>IP Address</code> of both the instances using <code>user_data</code> but this fails saying <code>Cycle Error</code>.</p>
  
  <p>Is there any way to get the file to generate with <code>IP Address</code> while the <code>ec2</code> instances are coming up</p>