I've never had terraform delete anything for me, including stuff in `.terraform`. But I'm guessing you are on Windows based on the backslashes in the path you listed. On Windows there is an issue with file links in which deleting the link can sometimes (always?) delete the file itself. So that's my gut instinct of what might have happened. It's a common problem mixing tools developed on Unix into a Windows environment.
I did some digging with strace and found that while `terraform get` does not delete anything, `terraform get -update` does call `unlink` to remove the existing symlinks before recreating them from scratch (even tho they point to the same place with the same ID) (see transcript below).
I don't have a Windows box on which to verify, but I'm guessing this is likely. I would say it's _not_ the expected behavior, but since the development and most of the use is done on Unix-like systems, the Windows gotchas probably rarely come up.
Sorry you lost your work. :(
Transcript:
$ terraform get
Get: file:///home/dave/working/tf/module/sub
Get: file:///home/dave/working/tf/module/sub2
$ strace -fo get.txt terraform get
Get: file:///home/dave/working/tf/module/sub
Get: file:///home/dave/working/tf/module/sub2
$ strace -fo get-update.txt terraform get -update
Get: file:///home/dave/working/tf/module/sub (update)
Get: file:///home/dave/working/tf/module/sub2 (update)
$ ls .terraform/modules/
39a9878006aae1874bee6f7da5632511 4d6ccdb0a67f0fa9a0657704b48d5967
$ grep 39a987 get.txt
13317 stat(".terraform/modules/39a9878006aae1874bee6f7da5632511", <unfinished ...>
13317 stat(".terraform/modules/39a9878006aae1874bee6f7da5632511", <unfinished ...>
13317 openat(AT_FDCWD, ".terraform/modules/39a9878006aae1874bee6f7da5632511", O_RDONLY|O_CLOEXEC <unfinished ...>
13317 lstat(".terraform/modules/39a9878006aae1874bee6f7da5632511/
main.tf", <unfinished ...>
13317 openat(AT_FDCWD, ".terraform/modules/39a9878006aae1874bee6f7da5632511/
main.tf", O_RDONLY|O_CLOEXEC <unfinished ...>
$ grep 39a987 get-update.txt
13346 lstat(".terraform/modules/39a9878006aae1874bee6f7da5632511", <unfinished ...>
13346 unlinkat(AT_FDCWD, ".terraform/modules/39a9878006aae1874bee6f7da5632511", 0 <unfinished ...>
13346 symlinkat("/home/dave/working/tf/module/sub", AT_FDCWD, ".terraform/modules/39a9878006aae1874bee6f7da5632511") = 0
13346 stat(".terraform/modules/39a9878006aae1874bee6f7da5632511", <unfinished ...>
13346 openat(AT_FDCWD, ".terraform/modules/39a9878006aae1874bee6f7da5632511", O_RDONLY|O_CLOEXEC <unfinished ...>
13346 lstat(".terraform/modules/39a9878006aae1874bee6f7da5632511/
main.tf", {st_mode=S_IFREG|0644, st_size=202, ...}) = 0
13346 openat(AT_FDCWD, ".terraform/modules/39a9878006aae1874bee6f7da5632511/
main.tf", O_RDONLY|O_CLOEXEC) = 6
eg, see that in a `terraform get` with existing modules, "unlink" is never called, but `terraform get -update` does trigger an `unlinkat` call. Whatever equivalent happens on Windows may be at fault here.