Why are git submodules empty when using a module via tfr:// in Spacelift?

Last updated: September 23, 2026

Context

When a Terraform/OpenTofu module that contains git submodules is referenced via the Spacelift module registry using the tfr:// protocol, the submodule directories appear empty during initialization, causing errors when Terraform tries to use resources defined in those submodules.

This is in contrast to referencing the same module directly via git::ssh://, which works correctly and populates the submodule content as expected.

Answer

This is a known limitation of the Spacelift module registry. When Spacelift serves a module via tfr://, it uses GitHub's auto-generated tarballs to deliver the module content. These tarballs do not include git submodule content, which is why submodule directories are empty after initialization.

In contrast, referencing a module via git::ssh:// performs a real git clone, which correctly initializes and populates git submodules.

Git submodules are not currently supported when using the Spacelift module registry (tfr://).

The available workarounds are:

  1. Continue using git::ssh:// to reference the module directly from your version control system. This performs a full git clone and correctly handles submodules.

  2. Copy the submodule content directly into your repository, removing the git submodule dependency entirely.

  3. Publish the submodule as its own separate module in the Spacelift registry and reference it as an independent module source rather than a git submodule.

If you would like to see native git submodule support added to the Spacelift module registry, you can submit a feature request at https://feedback.spacelift.io.