I have this on my connection. The goal is to copy a file to this server on ec2.
connection {
type = "ssh"
host = aws_instance.example[0].public_ip
user = "ec2-user"
private_key ="${file(var.ssh_key_file_path)}"
}
However terraform does not accept the content of the file as in the documentation. It tries to read the file content as if it were a file itself. Passing the file name also results in invalid key.
connection {
type = "ssh"
host = aws_instance.example[0].public_ip
user = "ec2-user"
private_key =var.ssh_key_file_path
}
The documentation says
private_key - The contents of an SSH key to use for the connection. These can be loaded from a file on disk using the file function. This takes preference over the password if provided.
Output:
Error: stat -----BEGIN PRIVATE KEY-----
.
.
.
-----END PRIVATE KEY-----
: no such file or directory
Question
Has this behavior been modified? Or Am I missing something
I have this on my connection. The goal is to copy a file to this server on ec2.
However terraform does not accept the content of the file as in the documentation. It tries to read the file content as if it were a file itself. Passing the file name also results in invalid key.
The documentation says
Output: Error: stat -----BEGIN PRIVATE KEY----- . . . -----END PRIVATE KEY----- : no such file or directory
Question Has this behavior been modified? Or Am I missing something