【问题标题】:Provisioner sections in EC2 creation causing Terraform apply to failEC2 创建中的 Provisioner 部分导致 Terraform 应用失败
【发布时间】:2018-07-19 02:58:38
【问题描述】:

我在本地机器上运行 Terraform,通过堡垒机创建 Amazon Linux EC2。

当我在“aws_instance”资源中包含供应商条目时会出现问题。在没有配置器的情况下,创建成功完成

使用配置器“文件”部分我收到错误:

ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain

通过配置器“remote-exec”部分,我得到以下内容,它会不断重复直到超时:

module.create_ami.aws_instance.ec2 (remote-exec): Connecting to remote host via SSH...
module.create_ami.aws_instance.ec2 (remote-exec):   Host: 99.999.999.99
module.create_ami.aws_instance.ec2 (remote-exec):   User: ec2-user
module.create_ami.aws_instance.ec2 (remote-exec):   Password: false
module.create_ami.aws_instance.ec2 (remote-exec):   Private key: false
module.create_ami.aws_instance.ec2 (remote-exec):   SSH Agent: false
module.create_ami.aws_instance.ec2 (remote-exec): Using configured bastion host...

有谁知道为什么会发生这种情况或建议调查的事情?

【问题讨论】:

  • module.create_ami.aws_instance.ec2 (remote-exec): Host: 99.999.999.99 看起来不是一个有效的 IP
  • 我已经从这篇文章的实际价值中假想了它。

标签: terraform


【解决方案1】:

Remote-exec 无法 ssh 进入目标系统,作为输出 说-Private key:false

相信你不需要通过堡垒机来创建一台ec2机器,你甚至可以连接到本地机器。

如果你想在新创建的有一个公共IP的机器上使用remote exec,你可以直接连接到它,如果新创建的机器没有一个公共IP,那么你可以通过堡垒连接到它主持人。

【讨论】:

  • 扩展 Chandan 所说的内容:如果您的“aws_instance”有连接部分并且您正在运行选美,则不需要设置 bastion_private_key 或 private_key 属性。相反,将“代理”属性设置为 true 即可!
猜你喜欢
  • 2020-12-31
  • 2019-09-20
  • 2020-03-01
  • 1970-01-01
  • 2019-09-30
  • 2021-05-13
  • 2021-05-09
  • 1970-01-01
  • 2017-11-06
相关资源
最近更新 更多