terraform module symlink error

Created on 25 Aug 2015  ยท  11Comments  ยท  Source: hashicorp/terraform

My module was pointing to a GH repository. When debugging, I changed it to point to the local checkout of that repository. This caused the following error:

$ terraform get -update
Get: file:///Users/Jean/code/terraform/terraform-dcos (update)
Error loading Terraform: Error downloading modules: error downloading module 'file:///Users/Jean/code/terraform/terraform-dcos': destination exists and is not a symlink

removing the .terraform/modules directory solved the problem.

Some possible solutions:

  • automatically remove/override the module directory with a symlink
  • ask yes/no
  • clarify why the error happens and how to solve it
bug core

Most helpful comment

I was just bitten by this one, and spent a really long time trying to figure out why I wasn't seeing changes made to my modules. Deleting the entire .terraform directory and running terraform init seemed to fix it. I'm still not 100% sure why I would ever need to do this. This was using s3 state lock, but with no pre-existing state. Modules are suggested to be the right way to use Terraform, but I'm not clear on when using modules should necessitate deleting the .terraform directory to see module changes.

All 11 comments

I ran into this error as well. The changed module source doesn't load correctly.

+1
I have the same issue. Is there any ETA for this?

The clarification would be a useful addition. Just ran into this.

+1. This should be a pretty simple one to knock out.

Adding that I ran into this as well. Same issue :(

Having the same issue when running inside a docker container (docker-toolbox). Removing the .terraform/modules didn't solve for me.

(More to report than to solve as the issue is certainly linked to docker)

If you set s3 as state file backend, recommend to remove .terraform directly, because you need clean terraform.tfstate as well

I was just bitten by this one, and spent a really long time trying to figure out why I wasn't seeing changes made to my modules. Deleting the entire .terraform directory and running terraform init seemed to fix it. I'm still not 100% sure why I would ever need to do this. This was using s3 state lock, but with no pre-existing state. Modules are suggested to be the right way to use Terraform, but I'm not clear on when using modules should necessitate deleting the .terraform directory to see module changes.

Thank you @donbecker - I was having the same problems and your solution did the trick! I had made some changes to a module linked in another Github repo and it was not being picked up when I tried to rerun my main terraform. Must be some kind of cacheing issue. Cheers!

I encountered this same error today as well. Deleted the .terraform directory and ran an init as well.

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.

Was this page helpful?
0 / 5 - 0 ratings