简体   繁体   中英

How to make a SSH connection using pageant on terraform for provisioning files?

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)
}

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM