I'm facing a challenge with my current project structure, which consists of a repository containing modules and environments. While I acknowledge that it may not align with best practices, it's a requirement I must adhere to. The directory structure looks like this:
.
├── environments
│ ├── dev
│ │ ├── backend.tf
│ │ ├── main.tf
│ │ ├── providers.tf
│ │ ├── terraform.tfvars
│ │ └── variables.tf
│ └── prod
│ ├── backend.tf
│ ├── main.tf
│ ├── providers.tf
│ ├── terraform.tfvars
│ └── variables.tf
└── modules
├── outputs.tf
├── variables.tf
└── vpc.tf
The issue arises when attempting to use the relative path:
Initializing Terraform Cloud...
Initializing modules...
- vpc in
╷
│ Error: Unreadable module directory
│
│ Unable to evaluate directory symlink: lstat ../../modules: no such file or
│ directory
╵
╷
│ Error: Unreadable module directory
│
│ The directory could not be read for module "vpc" at main.tf:1.
╵
Operation failed: failed running terraform init (exit 1)
Strangely, using the full path /mnt/c/Users/vladimir/OneDrive/GitHub/tf-main/modules
resolves the issue. I'm currently working on Windows 11 with WSL2 and Ubuntu 22. When inspecting the path in VSCode, it appears that it's not correctly recognized. I'm puzzled by this behavior and unsure of what steps to take to address the problem. Any guidance on resolving this would be greatly appreciated.