【问题标题】:How to copy in additional files during "terraform get" that reside outside of the module directory?如何在“terraform get”期间复制位于模块目录之外的其他文件?
【发布时间】:2018-03-18 11:19:20
【问题描述】:

Hashicorp Consul repository 包含一个 Terraform 模块,用于在 AWS 中启动 Consul 集群。该模块引用了在shared/scripts目录下的模块父目录中找到的几个文件https://github.com/hashicorp/consul/tree/master/terraform

但是,当我在我的一个 .tf 文件中引用该模块并运行 terraform get 以下载该模块时,shared/scripts/ 下所需的文件不包含在下载的模块文件中,从而导致出现上述错误here

我在 Terraform 中的 module 部分如下所示:

module "consul" {
  source = "github.com/hashicorp/consul/terraform/aws"

  key_name = "example_key"
  key_path = "/path/to/example_key"
  region   = "us-east-1"
  servers  = "3"
  platform = "centos7"
}

是否有 terraform get 拉入模块目录之外的文件?

谢谢

【问题讨论】:

    标签: terraform


    【解决方案1】:

    通过查看这些文件的作用,我只需复制您需要的文件(取决于您是在 debian 还是 rhel 上部署),这将是 2/3 文件并将它们提供给配置器“文件”:

    https://www.terraform.io/docs/provisioners/file.html

    【讨论】:

    • 我可以手动将它们复制到我的本地 Terraform 工作区,我想知道是否有办法让 terraform 自动在 terraform get 上进行复制,即使这些文件在 @ 之外987654323@模块目录。
    猜你喜欢
    • 2021-01-23
    • 1970-01-01
    • 2020-09-05
    • 2013-07-26
    • 1970-01-01
    • 2012-05-23
    • 1970-01-01
    • 2011-11-19
    • 2021-07-16
    相关资源
    最近更新 更多