Hi All,
I have recently updated my terraform from v0.10.8 to v0.11.1
I am facing awkward issue while running terraform plan,
For first time running the command it gives me proper plan in output but while running the same command 2nd time it gives me below error while loading the module.
Error downloading modules: Error loading modules: module zookeeper: open .terraform/modules/3f10921295c292995128e9e36ebdfa9f: no such file or directory
It looks like some issue of provider or module, But my terraform gets initialized successfully with below output.
- provider.aws: version = "~> 1.2"
- provider.template: version = "~> 1.0"
Please suggest any solution!
It looks like I found the solution.
We have to delete the oldĀ .terraform directory before the creation of the fresh plan.
I am also running into this using multiple computers and syncing my Terraform directory with Dropbox. Unfortunately when I delete .terraform
for some strange reason it also deletes some of the source module .tf
files out of .terraform
. I am guessing it is related to Dropbox being silly though. Anybody else experience this?
FWIW, I ran into this no such file or directory
error after moving a repo holding my terraform files. I was able to simply delete .terraform
without repercussions, but ideally we'd be able to retain the state and avoid this error. If someone stumbles into this, would love to hear any thoughts (as might others who end up in a similar spot!)
@nodesocket Got the same issue and not on dropbox. Locally on windows
Sometimes when running terraform init I get the "Error downloading modules: Error loading modules" error and all my refering modules code are erased.
Insane..
Lucky to have local versioning with PhpStorm.
Edit: I think it's a matter of symlink VS windows shortcut or something like that.
If I delete the .terraform folder from windows, I don't have the issue.
If I delete the .terraform folder with rm -rf from "Cmder" command line utility, I have the issue everytime.
Can't speak to Windows, but I've got a Linux instance that I had to recover files from and moved the Terraform stuff into a different directory during recovery. Per this thread, I took a look at the .terraform directory/modules and found that the referenced module from my error was a symlink to the files' former location. Took a look at other files/folders in .terraform and found no other instances of symlinks, so updated the symlinks in .terraform/modules to point to the new location. Things are working fine now, though I have a hard time seeing how this could scale well.
I had a tyop in my CI build spec, I was doing this:
terraform init input=false
but I should have done this:
terraform init -input=false
Noting it here because I'm probably not the only one will will make that mistake and have a lot of trouble figuring it out.
I am also running into this using multiple computers and syncing my Terraform directory with Dropbox. Unfortunately when I delete
.terraform
for some strange reason it also deletes some of the source module.tf
files out of.terraform
. I am guessing it is related to Dropbox being silly though. Anybody else experience this?
It just happened to me, how can that be possible? I'm using dropbox to add an extra layer of security to my code but it turns out to be silly enough to remove extra files when I remove .terraform
?
@rcarcasses I can recommend a few things that I did that seemed to have resolve the issue for me.
First make sure you are runnng the latest version of Terraform.
Second, I switched from syncing all my Terraform projects from Dropbox to using Resilio Sync. Resilio Sync uses peer-to-peer and is crazy fast, and way less fragile in terms of syncing symbolic links and large amounts of small files. It also has the benefit of not storing your potentially sensitive Terraform files centrally on a 3rd party. Resilio Sync uses BitTorrent technology.
Thank you @nodesocket, I'll take a look (again) to Resilio, tips appreciated!
I experience this in my Ubuntu18.04 VirtualBox on Windows 10, with a synced folder for my project.
I've deleted .terraform on the ubuntu side and ran init again in the vm, no luck.
Same for deleting on the windows side and running init again in the vm.
Copying the files to a new directory within the VM and deleting .terraform worked, so it's an ugly but working solution.
Here's the error I got, even after deleting .terraform:
vagrant@build:/srv/sand/Terraform$ terraform init -upgrade
Upgrading modules...
- module.consul_cluster
Updating source "github.com/hashicorp/terraform-aws-consul//modules/consul-cluster?ref=v0.0.5"
- module.consul_cluster.security_group_rules
Updating source "../consul-security-group-rules"
Error downloading modules: Error loading modules: error downloading 'file:///srv/sand/Terraform/.terraform/modules/4ce710853acdaa38590c03e2dac886d5/modules/consul-security-group-rules': symlink /srv/sand/Terraform/.terraform/modules/4ce710853acdaa38590c03e2dac886d5/modules/consul-security-group-rules .terraform/modules/f7c395ef652743ef83905eba3981b0aa: protocol error
I realize this is a somewhat odd use case - editing in IntelliJ on Windows , applying in an ubuntu vm.
This is because we use a Helm S3 repo, and that plugin doesn't work on windows.
If you find this issue, and previous solutions didn't work, remember you need to get into every folder that contains .tf files, delete the .terraform directory and do a terraform get.
That solved the issue in my case.
on a new install, I am getting this issue in v0.11.13 (not ready to update to .12. I went through all the subtree and there are no other .terraform files to delete.
But the error is slightly different - Initializing modules...
- module.vpc
- module.bastion
- module.softnas
- module.workstation
- module.node
- module.vpc.vpc
Error downloading modules: Error loading modules: module vpc: Error parsing .terraform/modules/ee16f4d52d8fd55d82aa3351f0ccd953/terraform-aws-modules-terraform-aws-vpc-6c31234/main.tf: At 2:23: Unknown token: 2:23 IDENT max
Error: Error loading modules: module vpc: Error parsing .terraform/modules/ee16f4d52d8fd55d82aa3351f0ccd953/terraform-aws-modules-terraform-aws-vpc-6c31234/main.tf: At 2:23: Unknown token: 2:23 IDENT max
@queglay Are you downloading to a NFS filesystem?
I'm going to lock this issue because it has been closed for _30 days_ ā³. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
It looks like I found the solution.
We have to delete the oldĀ .terraform directory before the creation of the fresh plan.