Module with terrafile usage question

Hello,
I have a private module injected with the terrafile

My terrafile

org "gitlab.com"
mod "abc", source: "git@gitlab.com:myorg/stuff", branch: "latest"

in app/stacks/foo/main.tf I have

module "abc" {
  source = "git@gitlab.com:myorg/stuff"

  foo = ":BAR"
}

Notes:

  • When I do terraspace bundle, I see my external module in vendor/modules/abc.
  • When I do terraspace build, I see my module in .terraspace-cache/eu-west-2/dev/modules/abc
  • When I do terraspace plan, I see my module in .terraspace-cache/eu-west-2/dev/stacks/foo/.terraform/modules/abc

When I have made a change in my external module, I did see the change everywhere except at the plan step that keep the previous version.

  1. Is it the proper usage of module source (I start I was thinking it’s “abc” as source instead of the source from terrafile) ?
  2. If yes, perhaps adding an example in the documentation could be a plus.
  3. What did I miss that make plan, not upgrading the external module?

thanks

RE: 1. Is it the proper usage of module source (I start I was thinking it’s “abc” as source instead of the source from terrafile) ?

The Terrafile provides the info from where to pull the source code for the module definition. The module updated source code will only get pulled/updated/downloaded when

  • running terraspace bundle initially when there’s no Terrafile.lock yet
  • or running terraspace bundle update when Terrafile.lock already exists

Otherwise, the code downloaded to vendor/modules stays the same

RE: 2. If yes, perhaps adding an example in the documentation could be a plus.

RE: 3. What did I miss that make plan, not upgrading the external module?

Modules are not going to be automatically upgraded. They get locked via Terrafile.lock. They get upgraded when running terraspace bundle update

thanks for the answer