title: Add userdata for aws instance using data-source in terraform
body: <p>I need to create an AWS instance with user-data using terraform. I'm using <code>terraform 0.10.0</code>. </p>
  
  <p><strong>ec2.tf</strong></p>
  
  <pre><code>data "template_file" "user_data" {
    template = "userdata.tpl"
  }
  
  resource "aws_instance" "fluentd-web" {
    ami           = "${lookup(var.amis, var.aws_region)}"
    instance_type = "t2.micro"
    subnet_id = "${var.subnet_id}"
    user_data = "${data.template_file.user_data.rendered}"
    security_groups =[ "${aws_security_group.ec2_sg.id}" ]
    connection {
       ***
    }
  }
  </code></pre>
  
  <p><strong>userdata.tpl</strong> </p>
  
  <pre><code>#! /bin/bash
  
  apt install &lt;**&gt;
  </code></pre>
  
  <p>On applying the terraform, It shows no error. But the contents of the file is not getting populated as user-data. It just shows the file name as user-data.
  <a href="https://i.stack.imgur.com/ChBJt.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ChBJt.png" alt="AWS Console"></a></p>
  
  <p>How can I get the contents of the file as user-data?</p>