【问题标题】:Can't run terraform init after manully removed .terraform folder on Windows在 Windows 上手动删除 .terraform 文件夹后无法运行 terraform init
【发布时间】:2018-05-23 02:31:36
【问题描述】:

我遇到了 terraform init 和 terrafor get 的问题。我想让 terraform 重新下载我的模块,所以我删除了 .terraform 文件夹。但是当我尝试 terraform init 时,它总是给我类似的东西:

下载模块时出错:加载模块时出错:下载“ssh://git@mygitaddr”时出错:C:\cygwin64\bin\git.exe exited with 128: fatal: could not create work tree dir '.terraform\modules \b58395849f04859395839':没有这样的文件或目录。

看来 terraform 仍在寻找我的旧模块。我花了一些时间在网上搜索并怀疑这与符号链接有某种关系,但我不确定。但是,它在 intellij 中使用运行/调试配置以相同的设置运行没有问题。它也适用于 windows cmd 提示符。

我正在使用 terraform 0.11

【问题讨论】:

    标签: terraform


    【解决方案1】:

    请尝试以下步骤。

    1.) 启动 Cygwin 终端并转到您的 git/terraform 项目:

    $ cd git/<PROJECT>/<FOLDER with FILES.tf>
    

    2.) 现在创建 terraform-folder 和子文件夹:

    $ mkdir -p .terraform/modules/
    

    3.) 执行:

    $ terraform get
    

    【讨论】:

    • 感谢您的回答。我意识到是我的cygwin导致了这个问题。我的 cygwin 正在使用它自己的 git 工具,它试图在 cygwin 系统路径中找到 git 文件,当然它找不到它们。所以我不得不卸载 cygwin git 工具并让它使用我系统上的那个,它工作了。
    猜你喜欢
    • 1970-01-01
    • 2018-04-26
    • 2021-01-20
    • 2018-11-21
    • 2021-10-15
    • 2021-11-13
    • 1970-01-01
    • 1970-01-01
    • 2021-09-13
    相关资源
    最近更新 更多