title: Updating a count in a template_file is not affecting the output
body: <p>We have a system in place that uses a number of counted resources.  Up until now, they have been hardcoded to 2.  I've just introduced a new variable, <code>pairs</code>, with a default of 1 so we can start to increase this.  If it stays on that default of 1, the resulting <code>plan</code> shows no changes.  Here are the two items in play amongst many others:</p>
  
  <pre><code>data "template_file" "bootstrapuserdata" {
      count   = "${var.pairs * 2}"
      template = "${file("${path.module}/startup.ps1")}"
      vars {
          domain = "${var.domain}"
          region = "${var.region}"
          publicIp = "${element(var.public_ips, count.index)}"
          stack = "${var.stack}"
      }
  }
  
  
  resource "aws_launch_configuration" "lc" {
      count = "${var.pairs * 2}"
      name_prefix = "lc-${element(var.private_subnet_ids, count.index)}-"
      image_id = "${var.ami_id}"
      instance_type = "${var.instance_type}"
      iam_instance_profile = "${aws_iam_instance_profile.webserver_instance_profile.id}"
      key_name = "${var.key_name}"
      security_groups = ["${var.sg_id}", "${var.sg2_id}"]
      user_data = "${data.template_file.bootstrapuserdata.*.rendered[count.index]}"
      lifecycle {
          create_before_destroy = true
      }
  }
  </code></pre>
  
  <p>If I change the value of <code>pairs</code> to 2 (resulting in a count of 4 for both items), I get the following error from the <code>plan</code>:</p>
  
  <pre><code>Error: Error refreshing state: 1 error(s) occurred:
  
  
  * module.servers.aws_launch_configuration.lc: 2 error(s) occurred:
  
  * module.servers.aws_launch_configuration.lc[3]: index 3 out of range for list data.template_file.bootstrapuserdata.*.rendered (max 2) in:
  
  ${data.template_file.bootstrapuserdata.*.rendered[count.index]}
  * module.servers.aws_launch_configuration.lc[2]: index 2 out of range for list data.template_file.bootstrapuserdata.*.rendered (max 2) in:
  
  ${data.template_file.bootstrapuserdata.*.rendered[count.index]}
  </code></pre>
  
  <p>It's like it's not re-rendered the <code>template_file</code> with the updated count.  If I deliberately break the <code>template_file</code>, that sort of confirms it:</p>
  
  <pre><code>data "template_file" "bootstrapuserdata" {
      count   = "${var.pairs * 2}"
      template = "${file("${path.module}/startup.ps1")}"
      vars {
          #domain = "${var.domain}"
          region = "${var.region}"
          publicIp = "${element(var.public_ips, count.index)}"
          stack = "${var.stack}"
      }
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Error: Error refreshing state: 1 error(s) occurred:
  
  * module.servers.data.template_file.bootstrapuserdata: 2 error(s) occurred:
  
  * module.servers.data.template_file.bootstrapuserdata[1]: data.template_file.bootstrapuserdata.1: failed to render : 28:66: unknown variable accessed: domain
  * module.servers.data.template_file.bootstrapuserdata[0]: data.template_file.bootstrapuserdata.0: failed to render : 28:66: unknown variable accessed: domain
  </code></pre>
  
  <p>However, if I <em>really</em> break the <code>template_file</code>:</p>
  
  <pre><code>data "template_file" "bootstrapuserdata" {
      count   = "${var.pairs * 2}"
      template = "${file("${path.module}/startup.ps1")}"
      /*vars {
          domain = "${var.domain}"
          region = "${var.region}"
          publicIp = "${element(var.public_ips, count.index)}"
          stack = "${var.stack}"
      }*/
  }
  </code></pre>
  
  <p>It now knows about all 4:</p>
  
  <pre><code>Error: Error refreshing state: 1 error(s) occurred:
  
  * module.servers.data.template_file.bootstrapuserdata: 4 error(s) occurred:
  
  * module.servers.data.template_file.bootstrapuserdata[3]: data.template_file.bootstrapuserdata.3: failed to render : 15:106: unknown variable accessed: domain
  * module.servers.data.template_file.bootstrapuserdata[1]: data.template_file.bootstrapuserdata.1: failed to render : 15:106: unknown variable accessed: domain
  * module.servers.data.template_file.bootstrapuserdata[2]: data.template_file.bootstrapuserdata.2: failed to render : 15:106: unknown variable accessed: domain
  * module.servers.data.template_file.bootstrapuserdata[0]: data.template_file.bootstrapuserdata.0: failed to render : 15:106: unknown variable accessed: domain
  </code></pre>
  
  <p>What's going on?  Have I stumbled across a Terraform bug?</p>
  
  <p>I started the day on Terraform 0.10.6, but upgraded to 0.11.10 after seeing this issue - there's no difference between the two.</p>