Terraform的文件provisioner为什么需要连接配置?

huangapple go评论55阅读模式
英文:

Why mt terraform file provisioner need a connection configuration?

问题

我正在测试Terraform中的配置提供程序。这是我的示例:

resource "null_resource" "demo_provisioner" {
  provisioner "file" {
    source      = "C:\\test\\example.txt"
    destination = ".\\example.txt"
  }
}

我只是将一个本地文件复制到另一个地方,但我收到了以下错误消息:

配置提供程序缺少连接配置。

我不明白为什么会发生这种情况。文档提供了一些相似的示例,但没有提到连接。我的代码有什么问题?

英文:

I am testing provisioner in Terraform.
This is my sample:

resource "null_resource" "demo_provisioner" {
  provisioner "file" {
    source      = "C:\\test\\example.txt"
    destination = ".\\example.txt"
  }
}

I am just copying a local file to another one, but I get this erreor message:

> Missing connection configuration for provisioner.

I don't understand why this happen. The documentation gives some quite similar example without telling about connection.

What is wrong in my code?

答案1

得分: 1

如果您查看TF文档,它指出file provisioner 是关于将文件复制到远程机器,这需要连接到远程机器的 connection 信息。

要复制本地文件,您可以使用local_file

英文:

If you check TF docs, it says that file provisioner is about copping files to remote machine, which requires a connection information to the remote machine.

To copy local files, you can use local_file instead.

huangapple
  • 本文由 发表于 2023年4月4日 06:29:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/75924192.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定