Failed to read module directory.

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

Failed to read module directory

问题

I have a folder structure in the below format

demo
   proj
     terraform
       myfile.tf

The modules are present in the below path

demo
   modules
     terraform
       myconfigfiles
         vmcreation

How do I call the modules in terraform. The path of the source is not working. I tried this but it doesn't work

source = "../modules/terraform/myconfigfiles/vmcreation"

I am getting this error during terraform init

Error: Unreadable module directory

Unable to evaluate directory symlink: CreateFile ..\modules: The system cannot find the file specified.

Error: Failed to read module directory

Module directory does not exist or cannot be read.

英文:

I have a folder structure in the below format

demo
   proj
     terraform
       myfile.tf

The modules are present in the below path

demo
   modules
     terraform
       myconfigfiles
         vmcreation

How do I call the modules in terraform. The path of the source is not working. I tried this but it doesn't work

source = "../modules/terraform/myconfigfiles/vmcreation"

I am getting this error during terraform init

Error: Unreadable module directory
│ 
│ Unable to evaluate directory symlink: CreateFile ..\modules: The system
│ cannot find the file specified.
╵

╷
│ Error: Failed to read module directory
│ 
│ Module directory  does not exist or cannot be read.

</details>


# 答案1
**得分**: 1

翻译内容:

相对路径在根模块配置和声明的模块之间需要另一个 `..` 前缀:

    source = "../../modules/terraform/myconfigfiles/vmcreation"

<details>
<summary>英文:</summary>

The relative pathing between the root module config and the declared module requires another `..` prefix:

    source = &quot;../../modules/terraform/myconfigfiles/vmcreation&quot;

</details>



huangapple
  • 本文由 发表于 2023年5月25日 20:54:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/76332493.html
匿名

发表评论

匿名网友

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

确定