title: Terraform provisioner - Failed to read ssh private key: no key found
body: <p>I'm unable to fix the issue with file function. The file content is correct and the path is correct too. But I get the following error.</p>
  <p><code>Error: Failed to read ssh private key: no key found</code></p>
  <p>Anything wrong here? Why is it reporting <code>no key found</code>?</p>
  <p>Here is the code:</p>
  <pre><code>resource &quot;aws_instance&quot; &quot;web_south&quot; {
    for_each = {
      prod = &quot;t2.micro&quot;
      dev = &quot;t2.micro&quot;
    }
  
    ami = &quot;ami-0db0b3ab7df22e366&quot;
    instance_type = each.value
    key_name = &quot;linux-ssh&quot;
  
    connection {
      type = &quot;ssh&quot;
      host = self.public_ip
      user = &quot;ubuntu&quot;
      private_key = file(&quot;/home/vagrant/terraform-test/00_test2/linux-ssh&quot;)
    }
  
    provisioner &quot;local-exec&quot; {
      command = &quot;echo ${self.public_ip} &gt; public-ip.txt &quot;
    }
  
    provisioner &quot;file&quot; {
      #content = &quot;foobar&quot;
      source = &quot;public-ip.txt&quot;
      destination = &quot;/tmp/test.txt&quot;
    }
  
  
    tags = {
      Name = &quot;web-${each.key}_${local.setup_name}&quot;
    }
  }
  </code></pre>