0

当我运行应用程序时,我有以下代码,它会超时。创建了一个实例,但远程执行命令不起作用。我在 Windows 10 机器上运行它。Terraform 版本是 v0.12.12 provider.aws v2.33.0

resource "aws_instance" "web" {
  ami           = "ami-54d2a63b"
  instance_type = "t2.nano"
  key_name = "terra"
  tags = {
    Name = "HelloWorld"
  }
   connection {
    type     = "ssh"
    user     = "ubuntu"
    private_key = "${file("C:/Users/Vinayak/Downloads/terra.pem")}"
    host     = self.public_ip

  }

  provisioner "remote-exec" {
    inline = [
      "echo cat > test.txt"
    ]
  }

}
4

1 回答 1

1

请尝试将您的主机线路更改为

host = "${self.public_ip}"

让人们知道您收到的实际错误消息也可能会有所帮助。:)

于 2019-10-25T04:17:42.883 回答