title: Invalid value for "path" parameter: no file exists at
body: <p>As mentioned at <a href="https://stackoverflow.com/questions/63613944/terraform-resource-connection-error-while-executing-apply">Terraform Resource: Connection Error while executing apply</a></p>
  <p>I changed my code to the the below</p>
  <pre><code>provisioner &quot;remote-exec&quot; {
      connection {
        type        = &quot;ssh&quot;
        host        = aws_eip.nat-eip.public_ip
        user        = &quot;ubuntu&quot;
        private_key = file(&quot;/id_rsa.pem&quot;)
      }
      inline = [
        &quot;chmod +x /tmp/start_node.sh&quot;,
        &quot;sudo sed -i -e 's/\r$//' /tmp/start_node.sh&quot;, # Remove the spurious CR characters.
        &quot;sudo /tmp/start_node.sh&quot;,
      ]
    }
  </code></pre>
  <p>But I still get the same error</p>
  <pre><code>Error: Invalid function argument
  
    on explorer.tf line 60, in resource &quot;aws_instance&quot; &quot;explorer&quot;:
    60:       private_key = file(&quot;/id_rsa.pem&quot;)
  
  Invalid value for &quot;path&quot; parameter: no file exists at /id_rsa.pem;
  </code></pre>
  <p>this
  function works only with files that are distributed as part of the
  configuration source code, so if this file will be created by a resource in
  this configuration you must instead obtain this result from an attribute of
  that resource.</p>
  <p><code>ls -la</code> ooutput</p>
  <pre><code>total 156
  drwxr-xr-x  10 CORP\mayuresh CORP\domain users  4096 Jan 12 14:29 .
  drwxr-xr-x  16 CORP\mayuresh CORP\domain users  4096 Jan 10 13:10 ..
  drwxr-xr-x  12 CORP\mayuresh CORP\domain users  4096 Jan 12 09:49 byoc-terraform
  drwxr-xr-x   2 CORP\mayuresh CORP\domain users  4096 Jan 11 11:57 controllers
  -rw-r--r--   1 CORP\mayuresh CORP\domain users   188 Jan 10 13:27 .env
  -rw-r--r--   1 CORP\mayuresh CORP\domain users  1582 Jan 10 17:12 fetchUserData.js
  drwxr-xr-x   9 CORP\mayuresh CORP\domain users  4096 Jan 12 13:14 .git
  -rw-r--r--   1 CORP\mayuresh CORP\domain users   629 Jan 10 13:27 .gitignore
  -rw-r--r--   1 CORP\mayuresh CORP\domain users   107 Dec 30 06:49 .gitmodules
  -rw-r--r--   1 CORP\mayuresh CORP\domain users  1765 Jan 12 13:21 id_rsa.pem
  -rw-r--r--   1 CORP\mayuresh CORP\domain users  1488 Jan 10 13:27 index.js
  drwxr-xr-x   3 CORP\mayuresh CORP\domain users  4096 Jan 10 13:27 models
  drwxr-xr-x 221 CORP\mayuresh CORP\domain users 12288 Jan 10 13:30 node_modules
  -rw-r--r--   1 CORP\mayuresh CORP\domain users  1058 Jan 10 13:27 package.json
  -rw-r--r--   1 CORP\mayuresh CORP\domain users 78791 Jan 10 13:27 package-lock.json
  drwxr-xr-x   2 CORP\mayuresh CORP\domain users  4096 Jan 10 13:27 routes
  drwxr-xr-x   2 CORP\mayuresh CORP\domain users  4096 Jan 10 17:01 utils
  drwxr-xr-x   2 CORP\mayuresh CORP\domain users  4096 Jan 10 13:27 VMCreationFiles```
  </code></pre>