Using terraform v0.6.12
If you have been working with a module on the local filesystem (using the relative path to the directory as the 'source' parameter), then change the source to be a github repository, 'terraform get -update' appears to succeed but actually does nothing to change the version of the module that will be used when you run 'terraform plan'.
Steps to reproduce:
1) create a module in your local filesystem and use that module from within the root module
eg: module "foo" { source = "./foomod" }
2) run terraform get -update
3) confirm the cached module is a symlink: ls -l .terraform/modules/ should have a file that links to ./foomod
4) change the root module's invocation to point at a github repo instead (doesn't matter which one but it must exist)
eg module "foo" { source = "github.com/terraform-community-modules/tf_aws_sg" }
5) run terraform get -update
Observe:
There seem to be a number of other conditions in which 'terraform get -update' seems to succeed but actually fails, for example I switched from a vanilla github repo to one with a revision in a broken way (typoed ?rev=... instead of ?ref=...) and it appeared to succeed but actually failed. When I removed the cached module and re-ran terraform get -update, I got the proper error message.
I've realized that then the 'terraform get -update' commands above are failing, they're actually traversing the filesystem through the existing symlink and descending into the path on the filesystem for the module before running the relevant git commands. In other words, after switching from source="./foomod" to source="github.com/..." and running terraform get -update, I wind up with a git checkout in ./foomod (outside of the .terraform cache). hrmph.
Hi @maplebed! Thanks for opening this and the analysis on where the problem is - this is fairly nasty, we'll get it fixed up.
This is fixed in master as the location in ".terraform/modules" is now also tied to the source URL.
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
This is fixed in master as the location in ".terraform/modules" is now also tied to the source URL.