Hello,
I have been using the Terraform CLI successfully but have decided to move my state out of an S3 backend and into Terraform Cloud. To do this, I added the required cloud
settings to the terraform
block, and then ran terraform init
.
terraform {
cloud {
organization = "my-org"
workspaces {
name = "dev-workspace"
}
}
}
All seemed to be working fine, and the resources managed by the state file were displayed in Terraform Cloud.
However, now whenever I try to plan/apply it fails, with the error stating no such file or directory
for my modules directory. But as can be seen at the end of the output below, I am able to change to that directory without issue.
Why can Terraform no longer find my modules?
user@ubuntu:~/terraform/envs/dev$ terraform apply
Running apply in Terraform Cloud. Output will stream here. Pressing Ctrl-C
will cancel the remote apply if it's still pending. If the apply started it
will stop streaming the logs, but will not stop the apply running remotely.
Preparing the remote apply...
To view this run in a browser, visit:
https://app.terraform.io/app/my-org/dev-workspace/runs/run-xxUvi7tmy3mc87mg
Waiting for the plan to start...
Terraform v1.5.7
on linux_amd64
Initializing plugins and modules...
Initializing Terraform Cloud...
Initializing modules...
- sandbox 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 "sandbox" at main.tf:1.
╵
Operation failed: failed running terraform init (exit 1)
user@ubuntu:~/terraform/envs/dev$ cd ../../modules
user@ubuntu:~/terraform/modules$