0
votes

How to make a SSH connection via pageant on terraform? I'm trying to provision files with file provisioner running on SSH connection. According to docs, on windows, only supported ssh agent is Pageant, but it does not explain how to configure it.

https://www.terraform.io/docs/provisioners/connection.html

Even after adding directory of PuTTY to the PATH env var (which is included in GitExtension), terraform does not seem to detect that, and keep failing to make SSH connection. Connecting via plink.exe works, so my SSH key is correctly added to the Pageant.

plink core@<ip-address-of-host>

File provisioner works when I pass the content of private_key directly like this, but that's not what I want.

connection {
  type        = "ssh"
  host        = aws_instance.instance.public_ip
  user        = "core"
  agent       = false
  private_key = file(var.private_key_path)
}
1
Are you saying it doesn't work if you set agent to true and don't provide the private_key parameter?ydaetskcoR
Yes, it doesn't work if I do that. On WSL ubuntu with ssh-agent it worked as expected.user2129038

1 Answers

0
votes

You have to set the agent parameter to true:

  • agent - Set to false to disable using ssh-agent to authenticate. On Windows the only supported SSH authentication agent is Pageant.

  agent       = true