我从我的本地机器运行Terraform,通过堡垒机器来创建Amazon Linux EC2 .
当我在"aws_instance"资源中包含配置程序条目时,会发生此问题 . 没有供应商, the creation completes successfully .
使用配置程序“文件”部分,我收到错误:
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...
有谁知道为什么会发生这种情况或建议调查的事情?
1 回答
我相信你不需要通过堡垒主机来创建一台ec2机器,你甚至可以连接到本地机器 .
如果要在新创建的具有一个公共IP的计算机上使用远程执行,则可以直接连接到该计算机,如果新创建的计算机没有一个公共IP,则可以通过堡垒主机连接到该计算机 .
直接连接:https://www.terraform.io/docs/provisioners/connection.html
通过堡垒主机连接:https://github.com/hashicorp/terraform/issues/6263