0
votes

I'm getting a ssh error that is not adding up when trying to apply a terraform plan:

  • ssh: handshake failed: ssh: no common algorithm for key exchange; client offered: [[email protected] ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 diffie-hellman-group14-sha1 diffie-hellman-group1-sha1], server offered: [diffie-hellman-group-exchange-sha256]

The instance can be connected to manually with the ssh key specified without issues. Here is the terraform connection string:

connection {
    type = "ssh"
    user = "ed209"
    private_key = "${file("${var.aws_key_path}")}"
    timeout = "2m"
    agent = true
    host = "${var.use_public_ip  ? aws_instance.castiron.public_ip : aws_instance.castiron.private_ip}" 
}

The connection is set to connect privately via the same route that I use ssh to manually connect to. Any ideas on what to try?

1
What version of Terraform are you using?strongjz
Terraform v0.10.6TyMac

1 Answers

0
votes

The way to use variable in file function is wrong. Should be:

private_key = "${file(var.aws_key_path)}"