首页 > 解决方案 > Terraform remote-exec 永远创建

问题描述

我有一个 terraform main.tf,它有一个remote-exec配置程序来创建文件,但它需要很长时间并给出以下错误

错误:超时 - 最后一个错误:SSH 身份验证失败(root@34.94.107.128:22):ssh:握手失败:ssh:无法验证,尝试的方法 [none],没有支持的方法

它永远不会停止。

这就是我想要做的:

resource "null_resource" "web3" {
  triggers = {
    key = "${uuid()}"
  }
  provisioner "remote-exec" {
    inline = [
      "touch /etc/machan_kohomada_remote_execution"
    ]
    connection {
        type = "ssh"
        host = google_compute_instance.first-two-servers[0].network_interface.0.access_config.0.nat_ip
    }
  }
}

我想也许我remote-exec以错误的方式使用该功能?我需要做的是:

我需要/etc/remote_execution在每个谷歌计算服务器中创建一个文件

标签: terraformterraform-provider-gcp

解决方案


推荐阅读