title: Inappropriate value - string expected - when used with count+ index
body: <p>I am stuck with the below problem (terraform v0.12.8);</p>
  
  <p>Where i am trying to use below as my module code and passing them to below resource;</p>
  
  <pre><code>module "nat_gateway" {
      source           = "../providers/aws/network/nat_gw/"
      total_nat_gws    = "${length(var.availability_zones)}"
      eip_id           = "${module.eip.*.eip_id}"
      target_subnet_id = "${module.public_subnet.*.subnet_id}"
      nat_gw_name_tag  = "NAT-${var.stack_name}"
  }
  </code></pre>
  
  <pre><code>resource "aws_nat_gateway" "nat_gw" {
      count         = "${var.total_nat_gws}"
      allocation_id = "${element("${var.eip_id}", count.index)}"
      subnet_id     = "${element("${var.target_subnet_id}", count.index)}"
  
      tags = {
          Name = "${var.nat_gw_name_tag}"
      }
  }
  </code></pre>
  
  <p>I expected, it would create multiple NAT gateways with the provided multiple EIP's and subnet's. But fails with below error;</p>
  
  <pre><code>Error: Incorrect attribute value type
  
    on ../providers/aws/network/nat_gw/nat_gateway.tf line 12, in resource "aws_nat_gateway" "nat_gw":
    12:     allocation_id = "${element("${var.eip_id}", count.index)}"
  
  Inappropriate value for attribute "allocation_id": string required.
  
  
  Error: Incorrect attribute value type
  
    on ../providers/aws/network/nat_gw/nat_gateway.tf line 12, in resource "aws_nat_gateway" "nat_gw":
    12:     allocation_id = "${element("${var.eip_id}", count.index)}"
  
  Inappropriate value for attribute "allocation_id": string required.
  
  
  Error: Incorrect attribute value type
  
    on ../providers/aws/network/nat_gw/nat_gateway.tf line 13, in resource "aws_nat_gateway" "nat_gw":
    13:     subnet_id     = "${element("${var.target_subnet_id}", count.index)}"
  
  Inappropriate value for attribute "subnet_id": string required.
  
  
  Error: Incorrect attribute value type
  
    on ../providers/aws/network/nat_gw/nat_gateway.tf line 13, in resource "aws_nat_gateway" "nat_gw":
    13:     subnet_id     = "${element("${var.target_subnet_id}", count.index)}"
  </code></pre>
  
  <p>Can someone please help correct me.</p>