【问题标题】:How to make a SSH connection using pageant on terraform for provisioning files?如何使用 terraform 上的选美来建立 SSH 连接以提供文件?
【发布时间】:2020-03-05 21:06:38
【问题描述】:

如何通过 terraform 上的选美建立 SSH 连接?我正在尝试使用在 SSH 连接上运行的文件配置器来配置文件。根据文档,在 windows 上,仅支持 ssh 代理是 Pageant,但没有说明如何配置它。

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

即使将 PuTTY 目录添加到 PATH env var(包含在 GitExtension 中),terraform 似乎也没有检测到这一点,并且一直无法建立 SSH 连接。 通过 plink.exe 连接有效,因此我的 SSH 密钥已正确添加到 Pageant。

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

当我像这样直接传递 private_key 的内容时,文件配置器工作,但这不是我想要的。

connection {
  type        = "ssh"
  host        = aws_instance.instance.public_ip
  user        = "core"
  agent       = false
  private_key = file(var.private_key_path)
}

【问题讨论】:

  • 你是说如果你把agent设置成true并且不提供private_key参数就不行吗?
  • 是的,如果我这样做是行不通的。在带有 ssh-agent 的 WSL ubuntu 上,它按预期工作。

标签: windows ssh terraform putty pageant


【解决方案1】:

您必须将agent parameter 设置为true

  • agent - 设置为 false 以禁用使用 ssh-agent 进行身份验证。在 Windows 上,唯一受支持的 SSH 身份验证代理是 Pageant。

  agent       = true

【讨论】:

  • 你用 pgagent 试过了吗?我无法让它在 Windows 上运行。
  • 我没有 Terraform。但是您对agent = false 的问题的配置无法正常工作。如果它也不适用于agent = true,你应该在你的问题中说出来。
猜你喜欢
  • 2017-12-13
  • 2020-10-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-06-06
  • 1970-01-01
相关资源
最近更新 更多