简体   繁体   English

如何使用 terraform 上的选美来建立 SSH 连接以提供文件?

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

How to make a SSH connection via pageant on terraform?如何通过 terraform 上的选美来建立 SSH 连接? I'm trying to provision files with file provisioner running on SSH connection.我正在尝试使用在 SSH 连接上运行的文件配置器来配置文件。 According to docs, on windows, only supported ssh agent is Pageant, but it does not explain how to configure it.根据文档,在 windows 上,仅支持 ssh 代理是 Pageant,但没有说明如何配置它。

https://www.terraform.io/docs/provisioners/connection.html 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.即使在将 PuTTY 目录添加到 PATH env var(包含在 GitExtension 中)之后,terraform 似乎也没有检测到这一点,并且一直无法建立 SSH 连接。 Connecting via plink.exe works, so my SSH key is correctly added to the Pageant.通过 plink.exe 连接有效,因此我的 SSH 密钥已正确添加到选美。

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.当我像这样直接传递 private_key 的内容时,文件配置器工作,但这不是我想要的。

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参数设置为true

  • agent - Set to false to disable using ssh-agent to authenticate. agent - 设置为false以禁用使用ssh-agent进行身份验证。 On Windows the only supported SSH authentication agent is Pageant.在 Windows 上,唯一支持的 SSH 身份验证代理是 Pageant。

  agent       = true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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