英文:
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 = "../../modules/terraform/myconfigfiles/vmcreation"
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论